diff --git a/packages/craftcms-garnish/webpack.config.js b/packages/craftcms-garnish/webpack.config.js index 4006ff422c0..49a2f44a971 100644 --- a/packages/craftcms-garnish/webpack.config.js +++ b/packages/craftcms-garnish/webpack.config.js @@ -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, @@ -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') + ] } }), ],