Commit 1aab645f authored by wildfirecode's avatar wildfirecode

1

parent fab0afc1
...@@ -4,10 +4,21 @@ const WebpackDevServer = require('webpack-dev-server'); ...@@ -4,10 +4,21 @@ const WebpackDevServer = require('webpack-dev-server');
var serverStart = proj => { var serverStart = proj => {
const devConfig = getDevConfig(proj); const devConfig = getDevConfig(proj);
// 遍历每个entry,加入dev-server client
Object.keys(devConfig.entry).forEach(function(name) {
let _devServer = `webpack-dev-server/client?http://localhost:8080`;
devConfig.entry[name] = [_devServer].concat(devConfig.entry[name]);
});
console.log(devConfig.entry)
var compiler = webpack(devConfig); var compiler = webpack(devConfig);
const devServerOptions = { const devServerOptions = {
host: '0.0.0.0', host: '0.0.0.0',
watchContentBase: true,
contentBase: `./${proj}`, contentBase: `./${proj}`,
proxy: { proxy: {
'/ngapi/*': 'http://localhost:3000', '/ngapi/*': 'http://localhost:3000',
...@@ -29,6 +40,7 @@ var serverStart = proj => { ...@@ -29,6 +40,7 @@ var serverStart = proj => {
const devServer = new WebpackDevServer(compiler, devServerOptions); const devServer = new WebpackDevServer(compiler, devServerOptions);
devServer.listen(8080, '0.0.0.0', () => { devServer.listen(8080, '0.0.0.0', () => {
console.log(`Starting server ...`); console.log(`Starting server ...`);
}); });
}; };
......
...@@ -2,7 +2,7 @@ const path = require('path'); ...@@ -2,7 +2,7 @@ const path = require('path');
module.exports = proj => { module.exports = proj => {
const result = { const result = {
entry: `./${proj}/src/Main.ts`, entry: {app:`./${proj}/src/Main.ts`},
module: { module: {
rules: [ rules: [
{ {
......
...@@ -13,5 +13,5 @@ ...@@ -13,5 +13,5 @@
"webpack-merge": "^4.1.2", "webpack-merge": "^4.1.2",
"mock-webpack-plugin": "^2.0.0" "mock-webpack-plugin": "^2.0.0"
}, },
"version": "0.0.3" "version": "0.0.4"
} }
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment