script-loader

script-loader essentially allows JavaScript to be loaded in a single instance. This applies globally throughout your project. Let's set this up by going through the following steps:

  1. To install script-loader, type the following in the command line:
npm install --save-dev script-loader
Note that this doesn't work in Node.js.
  1. Use webpack.config.js to configure Webpack, which will export exec from 'script.exec.js';.:
module.exports = {
module: {
rules: [{
test: /.exec.js$/,
use: ['script-loader']
}]
}
}

There is also an inline way of doing this, as follows:

import exec from 'script-loader!./script.js';

That should be all you need to be able to use script-loader with your Webpack application. Next is source-map-loader.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.143.0.157