feat: add debug build (#1506)

more-tiny-style-fixes
Nolan Lawson 2019-09-21 13:44:32 -07:00 zatwierdzone przez GitHub
rodzic 5332a4e1e9
commit b32be27cf7
Nie znaleziono w bazie danych klucza dla tego podpisu
ID klucza GPG: 4AEE18F83AFDEB23
5 zmienionych plików z 12 dodań i 5 usunięć

Wyświetl plik

@ -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.:

Wyświetl plik

@ -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

Wyświetl plik

@ -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)
}

Wyświetl plik

@ -23,5 +23,5 @@ module.exports = {
'process.env.SAPPER_TIMESTAMP': process.env.SAPPER_TIMESTAMP || Date.now()
}),
terser()
]
].filter(Boolean)
}

Wyświetl plik

@ -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,