Describe the bug
I have the following project folder structure:
my-app/
├─ .webpack/
│ ├─ index.js
│ ├─ development.js
│ ├─ production.js
├─ node_modules/
├─ src/
│ ├─ index.tsx
├─ package.json
When I use .webpack/index.js to import a specific environment configuration I get the following error:
ERROR in main
Module not found: Error: Can't resolve './src' in '/Users/<path-to-project>/my-app'
To Reproduce
package.json
"@webpack-cli/serve": "^1.0.1-rc.0",
"webpack": "^5.0.0-rc.0",
"webpack-cli": "^4.0.0-rc.0",
"webpack-dev-server": "^3.11.0"
.webpack/index.js
module.exports = (env, arg) => {
const { mode } = arg;
const config = require(`./${mode}`);
return config;
};
.webpack/development.js
module.exports = {
entry: path.resolve(__dirname, '../src/index.tsx'),
output: {
path: path.resolve(__dirname, '../build/'),
filename: 'index.js'
},
devtool: 'source-map',
devServer: {
inline: true,
port: 8080,
contentBase: path.resolve(__dirname, '../src')
},
module: {
rules: [
{ test: /\.tsx?$/, loader: 'awesome-typescript-loader' }
]
},
resolve: {
modules: [
'/Users/<path-to-project>/my-app/src',
'node_modules'
],
extensions: ['.wasm', '.mjs', '.js', '.jsx', '.ts', '.tsx', '.json'],
}
};
> webpack serve --config .webpack/index.js --mode development
Expected behavior
Expected the src directory to be resolved. If instead .webpack/index.js has the configuration there is no error that shows up.
Please paste the results of webpack-cli info here, and mention other relevant information
System:
OS: macOS 10.15.6
CPU: (8) x64 Intel(R) Core(TM) i7-4870HQ CPU @ 2.50GHz
Memory: 451.53 MB / 16.00 GB
Binaries:
Node: 14.5.0 - ~/.nvm/versions/node/v14.5.0/bin/node
Yarn: 1.22.4 - /usr/local/bin/yarn
npm: 6.14.8 - ~/.nvm/versions/node/v14.5.0/bin/npm
Browsers:
Firefox: 81.0
Safari: 14.0
Packages:
case-sensitive-paths-webpack-plugin: ^2.3.0 => 2.3.0
clean-webpack-plugin: ^3.0.0 => 3.0.0
extract-css-chunks-webpack-plugin: ^4.7.5 => 4.7.5
html-webpack-plugin: ^4.5.0 => 4.5.0
webpack: ^5.0.0-rc.0 => 5.0.0-rc.0
webpack-cli: ^4.0.0-rc.0 => 4.0.0-rc.0
webpack-dev-server: ^3.11.0 => 3.11.0
webpack-merge: ^5.1.4 => 5.1.4
Describe the bug
I have the following project folder structure:
When I use
.webpack/index.jsto import a specific environment configuration I get the following error:To Reproduce
package.json
.webpack/index.js
.webpack/development.js
> webpack serve --config .webpack/index.js --mode developmentExpected behavior
Expected the
srcdirectory to be resolved. If instead.webpack/index.jshas the configuration there is no error that shows up.Please paste the results of
webpack-cli infohere, and mention other relevant informationSystem: OS: macOS 10.15.6 CPU: (8) x64 Intel(R) Core(TM) i7-4870HQ CPU @ 2.50GHz Memory: 451.53 MB / 16.00 GB Binaries: Node: 14.5.0 - ~/.nvm/versions/node/v14.5.0/bin/node Yarn: 1.22.4 - /usr/local/bin/yarn npm: 6.14.8 - ~/.nvm/versions/node/v14.5.0/bin/npm Browsers: Firefox: 81.0 Safari: 14.0 Packages: case-sensitive-paths-webpack-plugin: ^2.3.0 => 2.3.0 clean-webpack-plugin: ^3.0.0 => 3.0.0 extract-css-chunks-webpack-plugin: ^4.7.5 => 4.7.5 html-webpack-plugin: ^4.5.0 => 4.5.0 webpack: ^5.0.0-rc.0 => 5.0.0-rc.0 webpack-cli: ^4.0.0-rc.0 => 4.0.0-rc.0 webpack-dev-server: ^3.11.0 => 3.11.0 webpack-merge: ^5.1.4 => 5.1.4