{Boolean}
npm install --save-dev script-loader
Executes JS script once in global context.
:warning: Doesn't work in NodeJS
import './script.exec.js';
webpack.config.js
module.exports = { module: { rules: [ { test: /\.exec\.js$/, use: [ 'script-loader' ] } ] } }
import 'script-loader!./script.js';
Name | Type | Default | Description |
---|---|---|---|
| {Boolean} | false | Enable/Disable Sourcemaps |
| {Boolean} | true | Enable/Disable useStrict |
sourceMap
Type: Boolean
Default: false
To include source maps set the sourceMap
option.
webpack.config.js
module.exports = { module: { rules: [ { test: /\.script\.js$/, use: [ { loader: 'script-loader', options: { sourceMap: true, }, }, ] } ] } }
useStrict
Type: Boolean
Default: true
To disable use strict set the useStrict
option to false
.
webpack.config.js
module.exports = { module: { rules: [ { test: /\.script\.js$/, use: [ { loader: 'script-loader', options: { useStrict: false, }, }, ] } ] } }
© JS Foundation and other contributors
Licensed under the Creative Commons Attribution License 4.0.
https://v4.webpack.js.org/loaders/script-loader