Skip to content

Commit

Permalink
Remove glob
Browse files Browse the repository at this point in the history
  • Loading branch information
timkelty committed Jan 6, 2022
1 parent ce2c945 commit b7dd630
Showing 1 changed file with 9 additions and 11 deletions.
20 changes: 9 additions & 11 deletions packages/craftcms-garnish/webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,7 @@
/* globals module, require, __dirname */
const { getConfig } = require('@craftcms/webpack');
const MergeIntoSingleFilePlugin = require('webpack-merge-and-include-globally');
const glob = require('glob');

// chdir so the glob commands work when running from outside this dir
process.chdir(__dirname);

const files = glob.sync('lib/*.js');
files.push('src/Garnish.js', ...glob.sync('src/Base*.js'));
files.push(...glob.sync('src/*.js', {
ignore: files
}));
const {join} = require('path');

module.exports = getConfig({
context: __dirname,
Expand All @@ -20,7 +11,14 @@ module.exports = getConfig({
plugins: [
new MergeIntoSingleFilePlugin({
files: {
'garnish.js': files
'garnish.js': [

// Make paths absolute so this can be run from Craft root as well
join(__dirname, 'lib/*.js'),
join(__dirname, 'src/Garnish.js'),
join(__dirname, 'src/Base*.js'),
join(__dirname, 'src/!(Garnish|Base*).js')
]
}
}),
],
Expand Down

0 comments on commit b7dd630

Please sign in to comment.