Webpack-dev-server: Pass custom config file name

Created on 9 Aug 2017  路  3Comments  路  Source: webpack/webpack-dev-server

Do you want to request a feature or report a bug?

I think this is feature request because there's no explanation in the webpack document.

What is the current behavior?

pass config file name as argument raises errors.

$ node_modules/webpack-dev-server/bin/webpack-dev-server.js webpack.config.js

output:

    ERROR in ./~/tunnel-agent/index.js
    Module not found: Error: Can't resolve 'net' in '/Users/projects/frontend/node_modules/tunnel-agent'
     @ ./~/tunnel-agent/index.js 3:10-24
     @ ./~/request/lib/tunnel.js
     @ ./~/request/request.js
     @ ./~/request/index.js
     @ ./~/node-gyp/lib/install.js
     @ ./~/node-gyp/lib ^\.\/.*$
     @ ./~/node-gyp/lib/node-gyp.js
     @ ./~/fsevents/~/node-pre-gyp/lib/util/compile.js
     @ ./~/fsevents/~/node-pre-gyp/lib ^\.\/.*$
     @ ./~/fsevents/~/node-pre-gyp/lib/node-pre-gyp.js
     @ ./~/fsevents/fsevents.js
     @ ./~/chokidar/lib/fsevents-handler.js
     @ ./~/chokidar/index.js
     @ ./~/watchpack/lib/DirectoryWatcher.js
     @ ./~/watchpack/lib/watcherManager.js
     @ ./~/watchpack/lib/watchpack.js
     @ (webpack)/lib/node/NodeWatchFileSystem.js
     @ (webpack)/lib ^.*$
     @ (webpack)/lib/webpack.js
     @ ./webpack.config.js
     @ multi (webpack)-dev-server/client?http://localhost:3000 ./webpack.config.js

    ERROR in ./~/tunnel-agent/index.js
    Module not found: Error: Can't resolve 'tls' in '/Users/projects/frontend/node_modules/tunnel-agent'
     @ ./~/tunnel-agent/index.js 4:10-24
     @ ./~/request/lib/tunnel.js
     @ ./~/request/request.js
     @ ./~/request/index.js
     @ ./~/node-gyp/lib/install.js
     @ ./~/node-gyp/lib ^\.\/.*$
     @ ./~/node-gyp/lib/node-gyp.js
     @ ./~/fsevents/~/node-pre-gyp/lib/util/compile.js
     @ ./~/fsevents/~/node-pre-gyp/lib ^\.\/.*$
     @ ./~/fsevents/~/node-pre-gyp/lib/node-pre-gyp.js
     @ ./~/fsevents/fsevents.js
     @ ./~/chokidar/lib/fsevents-handler.js
     @ ./~/chokidar/index.js
     @ ./~/watchpack/lib/DirectoryWatcher.js
     @ ./~/watchpack/lib/watcherManager.js
     @ ./~/watchpack/lib/watchpack.js
     @ (webpack)/lib/node/NodeWatchFileSystem.js
     @ (webpack)/lib ^.*$
     @ (webpack)/lib/webpack.js
     @ ./webpack.config.js
     @ multi (webpack)-dev-server/client?http://localhost:3000 ./webpack.config.js

    ERROR in ./~/isexe/windows.js
    Module not found: Error: Can't resolve 'fs' in '/Users/projects/frontend/node_modules/isexe'
     @ ./~/isexe/windows.js 4:9-22
     @ ./~/isexe/index.js
     @ ./~/which/which.js
     @ ./~/node-gyp/lib/build.js
     @ ./~/node-gyp/lib ^\.\/.*$
     @ ./~/node-gyp/lib/node-gyp.js
     @ ./~/fsevents/~/node-pre-gyp/lib/util/compile.js
     @ ./~/fsevents/~/node-pre-gyp/lib ^\.\/.*$
     @ ./~/fsevents/~/node-pre-gyp/lib/node-pre-gyp.js
     @ ./~/fsevents/fsevents.js
     @ ./~/chokidar/lib/fsevents-handler.js
     @ ./~/chokidar/index.js
     @ ./~/watchpack/lib/DirectoryWatcher.js
     @ ./~/watchpack/lib/watcherManager.js
     @ ./~/watchpack/lib/watchpack.js
     @ (webpack)/lib/node/NodeWatchFileSystem.js
     @ (webpack)/lib ^.*$
     @ (webpack)/lib/webpack.js
     @ ./webpack.config.js
     @ multi (webpack)-dev-server/client?http://localhost:3000 ./webpack.config.js

    ERROR in ./~/isexe/mode.js
    Module not found: Error: Can't resolve 'fs' in '/Users/minjeongkim/mmt/projects/mmt_msa-frontend/node_modules/isexe'
     @ ./~/isexe/mode.js 4:9-22
     @ ./~/isexe/index.js
     @ ./~/which/which.js
     @ ./~/node-gyp/lib/build.js
     @ ./~/node-gyp/lib ^\.\/.*$
     @ ./~/node-gyp/lib/node-gyp.js
     @ ./~/fsevents/~/node-pre-gyp/lib/util/compile.js
     @ ./~/fsevents/~/node-pre-gyp/lib ^\.\/.*$
     @ ./~/fsevents/~/node-pre-gyp/lib/node-pre-gyp.js
     @ ./~/fsevents/fsevents.js
     @ ./~/chokidar/lib/fsevents-handler.js
     @ ./~/chokidar/index.js
     @ ./~/watchpack/lib/DirectoryWatcher.js
     @ ./~/watchpack/lib/watcherManager.js
     @ ./~/watchpack/lib/watchpack.js
     @ (webpack)/lib/node/NodeWatchFileSystem.js
     @ (webpack)/lib ^.*$
     @ (webpack)/lib/webpack.js
     @ ./webpack.config.js
     @ multi (webpack)-dev-server/client?http://localhost:3000 ./webpack.config.js

and this command is fine
$ node_modules/webpack-dev-server/bin/webpack-dev-server.js

If the current behavior is a bug, please provide the steps to reproduce.

you can test with any working webpack config files

What is the expected behavior?

pass file name as argument
$ node_modules/webpack-dev-server/bin/webpack-dev-server.js webpack.config.js

or like other options

$ node_modules/webpack-dev-server/bin/webpack-dev-server.js --config webpack.config.js

If this is a feature request, what is motivation or use case for changing the behavior?

Users can set custom name for webpack config file

Please mention your webpack and Operating System version.

macOS
webpack: 2.7.0
webpack-dev-server: 2.7.1

4 (nice to have) approved

Most helpful comment

I was able to verify that webpack ^3.4.1 and webpack-dev-server ^2.7.1 works when using a custom npm script:

``json "scripts": { "webpack-dev-server": "webpack-dev-server --open" }, ```` And calling like so:npm run webpack-dev-server -- --config my.custom.webpack.config`

All 3 comments

Please do submit a pull request for this feature, we'd happily review it.

I was able to verify that webpack ^3.4.1 and webpack-dev-server ^2.7.1 works when using a custom npm script:

``json "scripts": { "webpack-dev-server": "webpack-dev-server --open" }, ```` And calling like so:npm run webpack-dev-server -- --config my.custom.webpack.config`

@illepic nice! closing the issue.

Was this page helpful?
0 / 5 - 0 ratings