webpack-merge-and-include-globally
webpack-merge-and-include-globally copied to clipboard
Exclude js files
Not able to exclude js files by using regex
@vivekdaryani what regex are you using and filename should be ignored?
const MergeIntoSingleFilePlugin = require('webpack-merge-and-include-globally'); new MergeIntoSingleFilePlugin({ files: { 'responsive/3.0.11/js/aggregate.js': [path.resolve(src, 'responsive/3.0.11/js/backbone*.js'), '!'+path.resolve(src, 'responsive/3.0.11/js/backbone-alert*.js'), ]} })
@vivekdaryani
I believe a single entry responsive/3.0.11/js/backbone!(-alert)*.js' will solve this, just tested it locally (according to rules at https://www.npmjs.com/package/glob#glob-primer)
but I should definitely add parameter of files to ignore
Same to me. I'm not able to exclude files. I have the following array:
const allLegacyJSFiles = [
path.resolve(__dirname, 'src/js/**/*.module.js'),
path.resolve(__dirname, 'src/js/**/*!(.module)*.js'),
'!'+path.resolve(__dirname, 'src/js/**/*.es6.js'),
];
and then
...
plugins: [
new MergeIntoSingleFilePlugin({
files: {
'legacy.js': allLegacyJSFiles,
},
transform: {
'legacy.js': code => {
//let x = UglifyES.minify(code);
return code;
},
},
}),
new HtmlWebpackPlugin(),
],
...
and I see in the concatenation result all the .es6.js files that contain imports and export defaults keywords...
And even with
const allLegacyJSFiles = [
path.resolve(__dirname, 'src/js/**/*.module.js'),
path.resolve(__dirname, 'src/js/**/*!(.module|.es6)*.js'),
];
seems that .es6.js files are included 😕
@alessandro308 if you want to include all files except .es6.js you can do src/**/!(*.es6).js
what were you trying to do with .module files? exclude them if something stands between .module and .js?
using src/**/!(*.es6|*.module.*).js will exclude all files that end with module.*.js or es6.js
you can use https://globster.xyz to test glob patterns