Webpack: How to export JS file without module -


i have js file looks this:

self.monacoenvironment = {   baseurl: cdn_host + '/javascripts' }; importscripts('/javascripts/vs/base/worker/workermain.js'); 

in webpack.config, have cdn_host defined:

new webpack.defineplugin({   'cdn_host': json.stringify(process.env.cdn_host || '') }), enter code here 

i export file, have cdn_host replaced value here, not want file wrapped in module (e.g, "webpackjsonp")

if use file-loader copy file module definitions, not replace cdn_host.

if use babel-loader, replace cdn_host add module definitions.

how can use defineplugin not use modules?

i managed without using defineplugin. instead, used file-loader chained string-replace-loader. string-replace-loader equivalent defineplugin purposes.

loaders: [     "file-loader?name=./filetoexport.js",     {       loader: "string-replace-loader",       query: {          search: 'cdn_host',         replace: json.stringify(process.env.cdn_host || '')       }     },   ] 

Comments

Popular posts from this blog

How to understand 2 main() functions after using uftrace to profile the C++ program? -

c# - Update a combobox from a presenter (MVP) -

How to put a lock and transaction on table using spring 4 or above using jdbcTemplate and annotations like @Transactional? -