1.0.4 • Published 6 years ago
non-module-bundler-plugin v1.0.4
npm i --save-dev non-module-bundler-pluginJust add the plugin to your webpack config as follows:
webpack.config.js
const path = require('path');
const NonModuleBundlerPlugin = require('non-module-bundler-plugin')
module.exports = {
entry: 'index.js',
output: {
path: __dirname + '/dist',
filename: 'index.js',
compress: false
},
plugins: [
new NonModuleBundlerPlugin({
filename: 'libs.js', // This is your output bundle name
sourceFiles: [
path.resolve(__dirname, './src/lib/script1.js'), // paths to script files
path.resolve(__dirname, './src/lib/script2.js'),
path.resolve(__dirname, './src/script3.js'),
path.resolve(__dirname, './src/lib/america_lib/script4.js'),
path.resolve(__dirname, './src/lib/china_lib/script5.js')
]
})
]
}This will generate a file named libs.js in your build folder dist containing merged code of all your script files above.
Set the option 'compress' to 'true' to compress and minify the result, by defaults it's 'false';