kopia lustrzana https://github.com/nolanlawson/pinafore
feat: add debug build (#1506)
rodzic
5332a4e1e9
commit
b32be27cf7
|
@ -143,6 +143,12 @@ Pinafore also offers a "legacy" build designed for older browsers. To build this
|
|||
|
||||
LEGACY=1 yarn build
|
||||
|
||||
## Debug build
|
||||
|
||||
To disable minification in a production build (for debugging purposes), you can run:
|
||||
|
||||
DEBUG=1 yarn build
|
||||
|
||||
## Debugging Webpack
|
||||
|
||||
The Webpack Bundle Analyzer `report.html` and `stats.json` are available publicly via e.g.:
|
||||
|
|
|
@ -21,13 +21,14 @@ export async function buildInlineScript () {
|
|||
plugins: [
|
||||
replace({
|
||||
'process.browser': true,
|
||||
'process.env.LEGACY': JSON.stringify(process.env.LEGACY),
|
||||
'process.env.THEME_COLORS': JSON.stringify(themeColors)
|
||||
}),
|
||||
process.env.LEGACY && babel({
|
||||
runtimeHelpers: true,
|
||||
presets: ['@babel/preset-env']
|
||||
}),
|
||||
terser({
|
||||
!process.env.DEBUG && terser({
|
||||
mangle: true,
|
||||
compress: true,
|
||||
ecma: 8
|
||||
|
|
|
@ -88,7 +88,7 @@ module.exports = {
|
|||
optimization: dev ? {} : {
|
||||
minimizer: [
|
||||
terser()
|
||||
],
|
||||
].filter(Boolean),
|
||||
splitChunks: {
|
||||
chunks: 'async',
|
||||
minSize: 5000,
|
||||
|
@ -130,7 +130,7 @@ module.exports = {
|
|||
]),
|
||||
devtool: dev ? 'inline-source-map' : 'source-map',
|
||||
performance: {
|
||||
hints: dev ? false : 'error',
|
||||
hints: dev ? false : (process.env.DEBUG ? 'warning' : 'error'),
|
||||
assetFilter: assetFilename => {
|
||||
return !(/\.map$/.test(assetFilename)) && !/tesseract-asset/.test(assetFilename)
|
||||
}
|
||||
|
|
|
@ -23,5 +23,5 @@ module.exports = {
|
|||
'process.env.SAPPER_TIMESTAMP': process.env.SAPPER_TIMESTAMP || Date.now()
|
||||
}),
|
||||
terser()
|
||||
]
|
||||
].filter(Boolean)
|
||||
}
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
const TerserWebpackPlugin = require('terser-webpack-plugin')
|
||||
|
||||
module.exports = () => new TerserWebpackPlugin({
|
||||
module.exports = () => !process.env.DEBUG && new TerserWebpackPlugin({
|
||||
exclude: /tesseract-asset/,
|
||||
cache: true,
|
||||
parallel: true,
|
||||
|
|
Ładowanie…
Reference in New Issue