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