8 Matching Annotations
- Nov 2020
-
stackoverflow.com stackoverflow.com
-
BTW, the modules used to be called moduleDirectories in previous versions.
-
The resolving process is basically simple and distinguishes between three variants: absolute path: require("/home/me/file") relative path: require("../src/file") or require("./file") module path: require("module/lib/file")
Very important distinction
-
In contrast to import (which handles 1+2 pretty much the same way, but would send you looking in node_modules right away) path 'module' indeed means your project root for paths without a need to resolve, like output.path in your webpack config... and: (on resolving) Only 3 is subject to resolve.root and resolve.moduleDirectories resolving, see webpack docs here
-
The problem is that by default, module paths only work with things imported via npm because the new modules variable on resolve defaults to ["node_modules"]. This lets you import 3rd party code from npm really easily. But it means importing your code with a module path needs a config change.
-
-
webpack.js.org webpack.js.orgConcepts1
-
When enabled, symlinked resources are resolved to their real path, not their symlinked location. Note that this may cause module resolution to fail when using tools that symlink packages (like npm link)
-
-
gist.github.com gist.github.com
-
resolve: { extensions: ['.jsx', '.js'], modules: [ path.resolve(__dirname, 'src'), 'node_modules' ] },
-
There was a major refactoring in the resolver (https://github.com/webpack/enhanced-resolve). This means the resolving option were changed too. Mostly simplification and changes that make it more unlikely to configure it incorrectly.
Linked from: https://stackoverflow.com/a/36574982/47185
-
-
stackoverflow.com stackoverflow.com
-
For future reference, webpack 2 removed everything but modules as a way to resolve paths. This means root will not work.
-