mirror of
https://github.com/eugeny/tabby
synced 2025-12-12 10:45:45 +00:00
updated sourcemaps config
This commit is contained in:
@@ -1,18 +1,27 @@
|
|||||||
const path = require('path')
|
const path = require('path')
|
||||||
|
const webpack = require('webpack')
|
||||||
const BundleAnalyzerPlugin = require('webpack-bundle-analyzer').BundleAnalyzerPlugin
|
const BundleAnalyzerPlugin = require('webpack-bundle-analyzer').BundleAnalyzerPlugin
|
||||||
|
|
||||||
const bundleAnalyzer = new BundleAnalyzerPlugin({
|
const bundleAnalyzer = new BundleAnalyzerPlugin({
|
||||||
analyzerPort: 0,
|
analyzerPort: 0,
|
||||||
})
|
})
|
||||||
|
|
||||||
|
const sourceMapOptions = {
|
||||||
|
exclude: [/node_modules/, /vendor/],
|
||||||
|
filename: '[file].map',
|
||||||
|
}
|
||||||
|
|
||||||
|
if (process.env.CI) {
|
||||||
|
sourceMapOptions.append = '\n//# sourceMappingURL=../../../app.asar.unpacked/assets/webpack/[url]'
|
||||||
|
}
|
||||||
|
|
||||||
module.exports = options => {
|
module.exports = options => {
|
||||||
const isDev = !!process.env.TERMINUS_DEV
|
const isDev = !!process.env.TERMINUS_DEV
|
||||||
const devtool = process.env.WEBPACK_DEVTOOL ?? (isDev && process.platform === 'win32' ? 'eval-cheap-module-source-map' : 'cheap-module-source-map')
|
|
||||||
const config = {
|
const config = {
|
||||||
target: 'node',
|
target: 'node',
|
||||||
entry: 'src/index.ts',
|
entry: 'src/index.ts',
|
||||||
context: options.dirname,
|
context: options.dirname,
|
||||||
devtool,
|
devtool: false,
|
||||||
output: {
|
output: {
|
||||||
path: path.resolve(options.dirname, 'dist'),
|
path: path.resolve(options.dirname, 'dist'),
|
||||||
filename: 'index.js',
|
filename: 'index.js',
|
||||||
@@ -99,7 +108,9 @@ module.exports = options => {
|
|||||||
/^terminus-/,
|
/^terminus-/,
|
||||||
...options.externals || [],
|
...options.externals || [],
|
||||||
],
|
],
|
||||||
plugins: [],
|
plugins: [
|
||||||
|
new webpack.SourceMapDevToolPlugin(sourceMapOptions),
|
||||||
|
],
|
||||||
}
|
}
|
||||||
if (process.env.PLUGIN_BUNDLE_ANALYZER === options.name) {
|
if (process.env.PLUGIN_BUNDLE_ANALYZER === options.name) {
|
||||||
config.plugins.push(bundleAnalyzer)
|
config.plugins.push(bundleAnalyzer)
|
||||||
|
|||||||
Reference in New Issue
Block a user