-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathwebpack.mix.js
54 lines (45 loc) · 1.5 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
const mix = require('laravel-mix');
const wpPot = require('wp-pot');
mix.setPublicPath('public')
.sourceMaps(false)
/**
* admin assets - example of how to create a settings page using a React App.
*/
.ts('src/Domain/resources/js/admin/settings-page-app/index.tsx', 'public/js/ADDON_ID-settings-page-app.js')
// admin assets
.ts('src/Domain/resources/js/admin/ADDON_ID-admin.ts', 'public/js/')
.sass('src/Domain/resources/css/admin/ADDON_ID-admin.scss', 'public/css')
// frontend assets
.js('src/Domain/resources/js/frontend/ADDON_ID-frontend.js', 'public/js/')
.sass('src/Domain/resources/css/frontend/ADDON_ID-frontend.scss', 'public/css')
// images
.copy('src/Domain/resources/images/*.{jpg,jpeg,png,gif,svg}', 'public/images');
mix.webpackConfig({
externals: {
$: 'jQuery',
jquery: 'jQuery',
},
});
mix.options({
// Don't perform any css url rewriting by default
processCssUrls: false,
// Prevent LICENSE files from showing up in JS builds
terser: {
extractComments: (astNode, comment) => false,
terserOptions: {
format: {
comments: false,
},
},
},
});
if (mix.inProduction()) {
wpPot({
package: 'ADDON_ID',
domain: 'ADDON_TEXTDOMAIN',
destFile: 'languages/ADDON_TEXTDOMAIN.pot',
relativeTo: './',
bugReport: 'https://github.com/impress-org/give/issues/new/choose',
team: 'GiveWP <[email protected]>',
});
}