forked from cattr-app/desktop-application
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwebpack.mix.js
65 lines (56 loc) · 2.17 KB
/
webpack.mix.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
const path = require('path');
const mix = require('laravel-mix');
const SentryWebpackPlugin = require('@sentry/webpack-plugin');
mix.setPublicPath('./build');
mix.disableNotifications();
mix.webpackConfig({ target: 'electron-renderer', devtool: 'source-map' });
/* Build JS */
if (mix.inProduction)
mix.js('./app/renderer/js/app.js', 'app.js').vue().sourceMaps();
else
mix.js('./app/renderer/js/app.js', 'app.js').vue();
/* Build SASS */
mix
.sass('./app/renderer/scss/app.scss', 'app.css')
.options({ processCssUrls: false });
/* Copy static assets & templates */
mix
.copy('./app/renderer/app.html', path.resolve(__dirname, 'build', 'app.html'))
.copy('./app/renderer/fonts/**/*', path.resolve(__dirname, 'build', 'fonts'))
.copy('./app/renderer/screen-notie.html', path.resolve(__dirname, 'build', 'screen-notie.html'))
.copy(
'./node_modules/element-ui/packages/theme-chalk/lib/fonts/element-icons.woff',
path.resolve(__dirname, 'build', 'fonts', 'element-icons.woff'),
);
/* If MAKE_RELEASE flag is set, build renderer in production mode, then submit all the code to Sentry */
if (mix.inProduction && process.env.MAKE_RELEASE) {
// eslint-disable-next-line global-require
const packageManifest = require('./package.json');
// eslint-disable-next-line global-require
const sentryConfiguration = require('./.sentry.json');
mix.webpackConfig({
plugins: [
new SentryWebpackPlugin({
include: 'build',
urlPrefix: 'build/',
ignore: ['mix-manifest.json', 'app.css.map'],
configFile: '.sentry.renderer',
release: `${packageManifest.name}@${packageManifest.version}`,
setCommits: { auto: true },
url: sentryConfiguration.url,
org: sentryConfiguration.org,
project: sentryConfiguration.frontend.project,
}),
new SentryWebpackPlugin({
include: 'app/src',
urlPrefix: 'app/src/',
configFile: '.sentry.main',
release: `${packageManifest.name}@${packageManifest.version}`,
setCommits: { auto: true },
url: sentryConfiguration.url,
org: sentryConfiguration.org,
project: sentryConfiguration.backend.project,
}),
],
});
}