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,28 +17,33 @@ config.entry = {
|
||||||
path.join(__dirname, 'client', 'index.js'),
|
path.join(__dirname, 'client', 'index.js'),
|
||||||
],
|
],
|
||||||
};
|
};
|
||||||
config.devServer = {
|
if (!isProduction) {
|
||||||
compress: true,
|
config.devServer = {
|
||||||
contentBase: path.resolve(__dirname, 'resource'),
|
compress: true,
|
||||||
disableHostCheck: true,
|
contentBase: path.resolve(__dirname, 'resource'),
|
||||||
headers: {
|
disableHostCheck: true,
|
||||||
'Access-Control-Allow-Origin': '*',
|
headers: {
|
||||||
'Access-Control-Allow-Methods': 'GET, POST, PUT, DELETE, PATCH, OPTIONS',
|
'Access-Control-Allow-Origin': '*',
|
||||||
'Access-Control-Allow-Headers': 'X-Requested-With, content-type, Authorization',
|
'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,
|
|
||||||
},
|
},
|
||||||
},
|
host: '0.0.0.0',
|
||||||
stats: 'minimal',
|
overlay: true,
|
||||||
watchContentBase: true,
|
port: 8421,
|
||||||
};
|
// proxy: {
|
||||||
config.devtool = 'eval-source-map';
|
// '/avocado': {
|
||||||
|
// target: 'http://localhost:8420',
|
||||||
|
// ws: true,
|
||||||
|
// },
|
||||||
|
// },
|
||||||
|
stats: 'minimal',
|
||||||
|
watchContentBase: true,
|
||||||
|
};
|
||||||
|
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);
|
||||||
|
|
||||||
config.devtool = 'source-map';
|
if (!isProduction) {
|
||||||
|
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