mirror of
https://github.com/EnixCoda/Gitako.git
synced 2026-03-11 08:54:44 +00:00
build: allow accessing source map in dev
This commit is contained in:
parent
75f24661d6
commit
6f9d157cde
1 changed files with 13 additions and 4 deletions
|
|
@ -9,6 +9,7 @@ const BundleAnalyzerPlugin = require('webpack-bundle-analyzer').BundleAnalyzerPl
|
|||
const srcPath = path.resolve(__dirname, 'src')
|
||||
const packagesPath = path.resolve(__dirname, 'packages')
|
||||
|
||||
const IN_PRODUCTION_MODE = process.env.NODE_ENV === 'production'
|
||||
const plugins = [
|
||||
new CopyWebpackPlugin([
|
||||
{
|
||||
|
|
@ -17,9 +18,18 @@ const plugins = [
|
|||
transform(content) {
|
||||
const { version, description, author, homepage: homepage_url } = require('./package.json')
|
||||
const manifest = JSON.parse(content)
|
||||
return JSON.stringify(
|
||||
Object.assign(manifest, { version, description, author, homepage_url }),
|
||||
)
|
||||
Object.assign(manifest, {
|
||||
version,
|
||||
description,
|
||||
author,
|
||||
homepage_url,
|
||||
})
|
||||
if (!IN_PRODUCTION_MODE) {
|
||||
Object.assign(manifest, {
|
||||
web_accessible_resources: manifest.web_accessible_resources.concat('*.map'), // enable source mapping while developing
|
||||
})
|
||||
}
|
||||
return JSON.stringify(manifest)
|
||||
},
|
||||
},
|
||||
{
|
||||
|
|
@ -50,7 +60,6 @@ if (analyse) {
|
|||
console.log(`BundleAnalyzerPlugin added`)
|
||||
}
|
||||
|
||||
const IN_PRODUCTION_MODE = process.env.NODE_ENV === 'production'
|
||||
plugins.push(
|
||||
new webpack.DefinePlugin({
|
||||
'process.env.NODE_ENV': JSON.stringify(process.env.NODE_ENV),
|
||||
|
|
|
|||
Loading…
Reference in a new issue