Created
April 5, 2021 16:03
-
-
Save stoefln/f2e86f0e64cb1c74eb18dbae75196f0c to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const path = require('path') | |
const webpack = require('webpack') | |
const nodeExternals = require('webpack-node-externals') | |
const SentryCliPlugin = require('@sentry/webpack-plugin') | |
const package = require('./package.json') | |
const rules = [ | |
{ | |
test: /\.node$/, | |
use: 'node-loader' | |
}, | |
{ | |
test: /\.js$/, | |
exclude: /(node_modules|bower_compontents)/, | |
use: ['babel-loader'] | |
}, | |
{ | |
test: /\.css$/, | |
use: ['style-loader', 'css-loader'] | |
} | |
] | |
const plugins = [ | |
new webpack.DefinePlugin({ | |
'process.env.NODE_ENV': JSON.stringify('production') | |
}), | |
new SentryCliPlugin({ | |
release: 'Repeato' + package.version, | |
include: '.', | |
ignoreFile: '.sentrycliignore', | |
ignore: ['node_modules', 'webpack.config.js', 'webpack.production.config.js'], | |
configFile: 'sentry.properties', | |
urlPrefix: '~/', | |
debug: true | |
}) | |
] | |
const externals = [ | |
nodeExternals({ | |
whitelist: [/^(?!opencv4nodejs).*/i] | |
}) | |
] | |
const noParse = /iconv-loader\.js/ | |
const output = { | |
filename: '[name]-bundle.js', | |
sourceMapFilename: '[name]-bundle.js.map', | |
path: path.resolve(__dirname, 'static'), | |
publicPath: '/static/' | |
} | |
module.exports = [ | |
{ | |
devtool: 'source-map', | |
entry: { | |
index: ['@babel/polyfill', './index.js'] | |
}, | |
mode: 'production', | |
output, | |
module: { | |
rules, | |
noParse | |
}, | |
plugins, | |
target: 'electron-main', | |
node: { | |
// https://github.com/webpack/webpack/issues/1599#issuecomment-656218316 | |
__dirname: false | |
}, | |
externals | |
}, | |
{ | |
devtool: 'source-map', | |
entry: { | |
main: ['@babel/polyfill', './app/main.js'], | |
worker: ['@babel/polyfill', './app/worker.js'], | |
pdfexport: ['@babel/polyfill', './app/pdfExport.js'] | |
}, | |
mode: 'production', | |
output, | |
module: { | |
rules, | |
noParse | |
}, | |
plugins, | |
target: 'electron-renderer', | |
externals | |
} | |
] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment