Commit 798143e7 authored by 邓晓峰's avatar 邓晓峰

feat: custom webpack output-path

parent 3c453f51
const rm = require('rimraf');
const path = require('path');
rm(process.env.npm_config_releasepath ? path.resolve(process.env.npm_config_releasepath, 'CivManage'): `./CivManage`, err => {
if (err) throw err
})
...@@ -2,13 +2,13 @@ const path = require('path'); ...@@ -2,13 +2,13 @@ const path = require('path');
const webpack = require('webpack'); const webpack = require('webpack');
const slash = require('slash2'); const slash = require('slash2');
const CopyPlugin = require('copy-webpack-plugin'); const CopyPlugin = require('copy-webpack-plugin');
console.log();
module.exports = options => ({ module.exports = options => ({
mode: options.mode, mode: options.mode,
entry: options.entry, entry: options.entry,
output: Object.assign( output: Object.assign(
{ {
path: path.resolve(process.cwd(), 'build'), path: process.env.npm_config_releasepath ? path.resolve(process.env.npm_config_releasepath, 'CivManage'): path.resolve(process.cwd(), 'CivManage'),
publicPath: process.env.PUBLIC_PATH || '/CivManage/', publicPath: process.env.PUBLIC_PATH || '/CivManage/',
}, },
options.output, options.output,
...@@ -117,28 +117,28 @@ module.exports = options => ({ ...@@ -117,28 +117,28 @@ module.exports = options => ({
limit: 10 * 1024, limit: 10 * 1024,
}, },
}, },
{ // {
loader: 'image-webpack-loader', // loader: 'image-webpack-loader',
options: { // options: {
mozjpeg: { // mozjpeg: {
enabled: false, // enabled: false,
// NOTE: mozjpeg is disabled as it causes errors in some Linux environments // // NOTE: mozjpeg is disabled as it causes errors in some Linux environments
// Try enabling it in your environment by switching the config to: // // Try enabling it in your environment by switching the config to:
// enabled: true, // // enabled: true,
// progressive: true, // // progressive: true,
}, // },
gifsicle: { // gifsicle: {
interlaced: false, // interlaced: false,
}, // },
optipng: { // optipng: {
optimizationLevel: 7, // optimizationLevel: 7,
}, // },
pngquant: { // pngquant: {
quality: '65-90', // quality: '65-90',
speed: 4, // speed: 4,
}, // },
}, // },
}, // },
], ],
}, },
{ {
......
...@@ -21,7 +21,7 @@ ...@@ -21,7 +21,7 @@
"prebuild": "npm run build:clean", "prebuild": "npm run build:clean",
"build": "cross-env NODE_ENV=production webpack --config internals/webpack/webpack.prod.babel.js --color -p --progress --hide-modules --display-optimization-bailout", "build": "cross-env NODE_ENV=production webpack --config internals/webpack/webpack.prod.babel.js --color -p --progress --hide-modules --display-optimization-bailout",
"build:inspect": "cross-env NODE_ENV=production node --inspect-brk ./node_modules/webpack/bin/webpack.js --config internals/webpack/webpack.prod.babel.js --color -p --progress --hide-modules --display-optimization-bailout", "build:inspect": "cross-env NODE_ENV=production node --inspect-brk ./node_modules/webpack/bin/webpack.js --config internals/webpack/webpack.prod.babel.js --color -p --progress --hide-modules --display-optimization-bailout",
"build:clean": "rimraf ./build", "build:clean": "node ./internals/webpack/clean.js",
"start": "cross-env NODE_ENV=development node server", "start": "cross-env NODE_ENV=development node server",
"start:inspect": "cross-env NODE_ENV=development node --inspect=9229 server", "start:inspect": "cross-env NODE_ENV=development node --inspect=9229 server",
"start:tunnel": "cross-env NODE_ENV=development ENABLE_TUNNEL=true node server", "start:tunnel": "cross-env NODE_ENV=development ENABLE_TUNNEL=true node server",
...@@ -178,7 +178,6 @@ ...@@ -178,7 +178,6 @@
"html-webpack-plugin": "3.2.0", "html-webpack-plugin": "3.2.0",
"http-proxy-middleware": "^1.0.6", "http-proxy-middleware": "^1.0.6",
"husky": "^2.3.0", "husky": "^2.3.0",
"image-webpack-loader": "4.6.0",
"imports-loader": "0.8.0", "imports-loader": "0.8.0",
"jest-cli": "24.7.1", "jest-cli": "24.7.1",
"jest-dom": "3.1.3", "jest-dom": "3.1.3",
......
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