chore: build
This commit is contained in:
parent
4f7b0c74aa
commit
945ee700cb
|
@ -34,6 +34,7 @@
|
|||
"scripts": {
|
||||
"client": "webpack-dev-server --hot --config webpack.client.config.js",
|
||||
"server": "DEBUG=@avocado:* webpack --autorun --watch --hot --config webpack.server.config.js",
|
||||
"client:build": "webpack --config webpack.client.config.js",
|
||||
"server:build": "webpack --config webpack.server.config.js",
|
||||
"start": "webpack --config webpack.server.config.js && webpack-dev-server --config webpack.client.config.js"
|
||||
},
|
||||
|
|
|
@ -4,6 +4,7 @@ const HtmlWebpackPlugin = require('html-webpack-plugin');
|
|||
const webpack = require('webpack');
|
||||
|
||||
const config = require('./webpack.common.config');
|
||||
const isProduction = !!process.argv.find((arg) => '--production' === arg);
|
||||
|
||||
config.entry = {
|
||||
client: [
|
||||
|
@ -16,28 +17,33 @@ config.entry = {
|
|||
path.join(__dirname, 'client', 'index.js'),
|
||||
],
|
||||
};
|
||||
config.devServer = {
|
||||
compress: true,
|
||||
contentBase: path.resolve(__dirname, 'resource'),
|
||||
disableHostCheck: true,
|
||||
headers: {
|
||||
'Access-Control-Allow-Origin': '*',
|
||||
'Access-Control-Allow-Methods': 'GET, POST, PUT, DELETE, PATCH, OPTIONS',
|
||||
'Access-Control-Allow-Headers': 'X-Requested-With, content-type, Authorization',
|
||||
},
|
||||
host: '0.0.0.0',
|
||||
overlay: true,
|
||||
port: 8421,
|
||||
proxy: {
|
||||
'/avocado': {
|
||||
target: 'http://localhost:8420',
|
||||
ws: true,
|
||||
if (!isProduction) {
|
||||
config.devServer = {
|
||||
compress: true,
|
||||
contentBase: path.resolve(__dirname, 'resource'),
|
||||
disableHostCheck: true,
|
||||
headers: {
|
||||
'Access-Control-Allow-Origin': '*',
|
||||
'Access-Control-Allow-Methods': 'GET, POST, PUT, DELETE, PATCH, OPTIONS',
|
||||
'Access-Control-Allow-Headers': 'X-Requested-With, content-type, Authorization',
|
||||
},
|
||||
},
|
||||
stats: 'minimal',
|
||||
watchContentBase: true,
|
||||
};
|
||||
config.devtool = 'eval-source-map';
|
||||
host: '0.0.0.0',
|
||||
overlay: true,
|
||||
port: 8421,
|
||||
// proxy: {
|
||||
// '/avocado': {
|
||||
// target: 'http://localhost:8420',
|
||||
// ws: true,
|
||||
// },
|
||||
// },
|
||||
stats: 'minimal',
|
||||
watchContentBase: true,
|
||||
};
|
||||
config.devtool = 'eval-source-map';
|
||||
}
|
||||
else {
|
||||
config.devtool = 'source-map';
|
||||
}
|
||||
// Babel config file.
|
||||
config.module.rules[0].use.options.configFile = path.resolve(
|
||||
__dirname, 'babel.client.config.js'
|
||||
|
|
|
@ -5,8 +5,11 @@ const nodeExternals = require('webpack-node-externals');
|
|||
const StartServerPlugin = require('start-server-webpack-plugin');
|
||||
|
||||
const config = require('./webpack.common.config');
|
||||
const isProduction = !!process.argv.find((arg) => '--production' === arg);
|
||||
|
||||
config.devtool = 'source-map';
|
||||
if (!isProduction) {
|
||||
config.devtool = 'source-map';
|
||||
}
|
||||
config.entry = {
|
||||
server: [
|
||||
'source-map-support/register',
|
||||
|
|
Loading…
Reference in New Issue
Block a user