The resolve.root
option no longer exists in webpack 2. Instead, it is combined into resolve.modules
(from the official Migration Guide ). Webpack even throws an error that this is an invalid property. If you want to import from the root directory, you must change the permission configuration to:
resolve: { alias: { config: 'src/assets/js/config', js: 'src/assets/js' }, modules: [ path.resolve(__dirname), 'node_modules' ] }
Alternatively, you can use the absolute path in resolve.alias
like this:
resolve: { alias: { config: path.resolve(__dirname, 'src/assets/js/config'), js: path.resolve(__dirname, 'src/assets/js') } }
source share