Skip to content Skip to sidebar Skip to footer

Set Base Paths For My Files For Webpack

When using requirejs, I do this: require.config({ baseUrl: 'scripts' }); console.log('Starting!'); require(['A', 'B', 'C'], mainFunction); I was googling how to set the base p

Solution 1:

You've looked at the documentation for webpack 1. Webpack 2 removed resolve.root and unified it to resolve.modules, as shown in the Migration Guide of the official webpack 2+ docs.

The default value of resolve.modules is ["node_modules"] and if you want to keep the regular module resolution, you have to include it as well.

resolve: {
  modules: [
    path.resolve(__dirname, "scripts"),
    "node_modules"
  ]
}

Post a Comment for "Set Base Paths For My Files For Webpack"