The structure of my folders is as follows:
- test
- scripts
index.js
user.js
- default
- scripts
index.js
api.js
user.js
I need to allow the import path locally (the "test" directory), while backups in case of failure should be allowed through the "default" directory.
Code in test / scripts / index.js:
import api from 'scripts/api'; // should be taken from 'default'
import user from 'scripts/user; // should take the local 'user.js'
...
I am using Webpack 2.1.0 with the following configuration:
...
resolve: {
modules: [
path.resolve( './default' )
]
}
...
This configuration allows webpack to allow all module paths 'script/*'through "default", while relative paths './script/*'never leave the module directory, so the relative path cannot be used as a backup.
resolve.fallbackWebpack 2 seems to be not supported
normal-module-factory->before-resolve, , , .
- ?
?