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');
const webpack = require('webpack');
const slash = require('slash2');
const CopyPlugin = require('copy-webpack-plugin');
console.log();
module.exports = options => ({
mode: options.mode,
entry: options.entry,
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/',
},
options.output,
......@@ -117,28 +117,28 @@ module.exports = options => ({
limit: 10 * 1024,
},
},
{
loader: 'image-webpack-loader',
options: {
mozjpeg: {
enabled: false,
// NOTE: mozjpeg is disabled as it causes errors in some Linux environments
// Try enabling it in your environment by switching the config to:
// enabled: true,
// progressive: true,
},
gifsicle: {
interlaced: false,
},
optipng: {
optimizationLevel: 7,
},
pngquant: {
quality: '65-90',
speed: 4,
},
},
},
// {
// loader: 'image-webpack-loader',
// options: {
// mozjpeg: {
// enabled: false,
// // NOTE: mozjpeg is disabled as it causes errors in some Linux environments
// // Try enabling it in your environment by switching the config to:
// // enabled: true,
// // progressive: true,
// },
// gifsicle: {
// interlaced: false,
// },
// optipng: {
// optimizationLevel: 7,
// },
// pngquant: {
// quality: '65-90',
// speed: 4,
// },
// },
// },
],
},
{
......
......@@ -21,7 +21,7 @@
"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: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:inspect": "cross-env NODE_ENV=development node --inspect=9229 server",
"start:tunnel": "cross-env NODE_ENV=development ENABLE_TUNNEL=true node server",
......@@ -178,7 +178,6 @@
"html-webpack-plugin": "3.2.0",
"http-proxy-middleware": "^1.0.6",
"husky": "^2.3.0",
"image-webpack-loader": "4.6.0",
"imports-loader": "0.8.0",
"jest-cli": "24.7.1",
"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