2017-12-04 3 views
0

두 개의 부분으로 구성된 프로젝트가 있습니다. 관리 환경과 일반 사용자를위한 웹 부분이 있습니다. 각 파트에는 다른 애셋이 있으므로 webpack의 두 가지 구성이 있습니다. 첫 번째 이름은 webpack-front.config.js이고 두 번째 이름은 webpack-admin.config.js입니다.Webpack - webpack-dev-server 두 개의 구성

내 구조 : 나는 "--open 웹팩-dev에 서버를"실행하려고하면

├─┬ dist 
│ ├── front.bundle.js 
│ └── admin.bundle.js 
| 
├─┬ src 
│ ├─┬ front 
| | └── index.js 
│ └─┬ admin 
| └── index.js 

문제가 시작됩니다. Npm 인쇄 :

> webpack-dev-server --open 

No configuration file found and no entry configured via CLI option. 
When using the CLI you need to provide at least two arguments: entry and output. 
A configuration file could be named 'webpack.config.js' in the current directory. 
Use --help to display the CLI options. 
npm ERR! code ELIFECYCLE 
npm ERR! errno 255 
npm ERR! [email protected] start: `webpack-dev-server --open` 
npm ERR! Exit status 255 
npm ERR! 
npm ERR! Failed at the [email protected] start script. 
npm ERR! This is probably not a problem with npm. There is likely additional logging output above. 

npm ERR! A complete log of this run can be found in: 
npm ERR!  /root/.npm/_logs/2017-12-04T14_16_35_084Z-debug.log 

이 문제는 내 구성의 이름이 "webpack.config.js"가 아니기 때문에 발생합니다. 방법이 있습니까, webpack-dev-server를 다른 config 또는 한 번에 두 config를 사용하여 실행하는 방법이 있습니까?

답변

0

config 옵션을 사용하여 사용자 지정 구성 파일을 지정할 수 있습니다.

> webpack-dev-server --config /home/user/project/path_to_config_file