Commit 26d1c5f9 authored by wildfirecode's avatar wildfirecode

1

parent ce070688
......@@ -9,12 +9,20 @@ var serverStart = opts => {
let webpackConfig = devConfig(opts);
// 遍历每个entry,加入dev-server client
Object.keys(webpackConfig.entry).forEach(function (name) {
let _devServer = `webpack-dev-server/client?http://localhost:${
opts.devPort
}`;
webpackConfig.entry[name] = [_devServer].concat(webpackConfig.entry[name]);
});
// Object.keys(webpackConfig.entry).forEach(function (name) {
// let _devServer = `webpack-dev-server/client?http://localhost:${
// opts.devPort
// }`;
// webpackConfig.entry[name] = [_devServer].concat(webpackConfig.entry[name]);
// });
// 遍历每个entry,加入dev-server client
let _devServer = `webpack-dev-server/client?http://localhost:${
opts.devPort
}`;
webpackConfig.entry = [_devServer].concat(webpackConfig.entry);
var compiler = webpack(webpackConfig);
......@@ -23,20 +31,20 @@ var serverStart = opts => {
host: '0.0.0.0',
watchContentBase: true,
watchOptions: opts.devServerWatchOptions,
contentBase: `.`,
contentBase: '.',
proxy: opts.proxy,
after(app) {
// 自动打开浏览器
if (opts.BUILD_SKIN) {
opn(
`http://localhost:${opts.devPort}/${opts.BUILD_SKIN}/index.html`
path.join(`http://localhost:${opts.devPort}`, opts.BUILD_SKIN, 'index.html')
);
}
}
};
WebpackDevServer.addDevServerEntrypoints(webpackConfig, devServerOptions);
// WebpackDevServer.addDevServerEntrypoints(webpackConfig, devServerOptions);
const devServer = new WebpackDevServer(compiler, devServerOptions);
devServer.listen(opts.devPort, '0.0.0.0', () => {
console.log(`Starting server ...`);
......
......@@ -2,9 +2,10 @@ const path = require('path');
module.exports = opts => {
const result = {
entry: {
app: `./${opts.BUILD_SKIN}/src/Main.ts`
},
entry: `./${opts.BUILD_SKIN}/src/Main.ts`,
// entry: {
// app: path.join(opts.BUILD_SKIN, '/src/Main.ts')
// },
module: {
rules: [
{
......@@ -19,7 +20,7 @@ module.exports = opts => {
extensions: ['.tsx', '.ts', '.js']
},
output: {
filename: `./output.js`,
filename: `./${opts.BUILD_SKIN}/output.js`,
path: __dirname
}
};
......
......@@ -7,13 +7,7 @@ class DuibaGameBuild {
constructor(config) {
let defaults = {
devPort: 8081,
devServerWatchOptions: {
ignored: [
'src/**/*.js',
'**/*.md',
'bin-release',
]
},
devServerWatchOptions: {},
proxy: {
'/ngapi/*': 'http://localhost:3000',
'/plugin/*': 'http://localhost:3000',
......
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