-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwebpack.config.js
43 lines (41 loc) · 1.74 KB
/
webpack.config.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
const defaultConfig = require('@wordpress/scripts/config/webpack.config');
const path = require( 'path' );
const CopyPlugin = require("copy-webpack-plugin");
for(let pluginIdx = 0; pluginIdx < defaultConfig.plugins.length; pluginIdx++){
const nextPlugin = defaultConfig.plugins[pluginIdx];
if(nextPlugin.options && nextPlugin.options.filename === '[name].css'){
nextPlugin.options.filename = 'styles/[name].css';
nextPlugin.options.chunkFilename = 'styles/[name].css';
}
}
module.exports = {
...defaultConfig,
externals: {
"PracticeBirdDeepLink": "PracticeBirdDeepLink"
},
entry: {
osmd_block: path.resolve( process.cwd(), 'src/osmd_block', 'index.js' ),
pbdeeplink_block: path.resolve( process.cwd(), 'src/pbdeeplink_block', 'index.js' ),
pbdeeplink_frontend: path.resolve( process.cwd(), 'src/pbdeeplink_block', 'frontend.js' )
},
output: {
...defaultConfig.output,
filename: '[name].js'
},
externals: {
'opensheetmusicdisplay-wordpress-block': 'window["opensheetmusicdisplay-wordpress-block"]',
opensheetmusicdisplay: 'opensheetmusicdisplay',
PracticeBirdDeepLink: 'PracticeBirdDeepLink',
externalsType: 'umd'
},
plugins: [... defaultConfig.plugins,
new CopyPlugin({
patterns: [
{from: 'node_modules/pb-deep-link/**/endpoint.min.js', to: 'pbdeeplink/endpoint.min.js'},
{from: 'node_modules/pb-deep-link/**/qrcode.min.js', to: 'pbdeeplink/qrcode.min.js'},
{from: 'node_modules/pb-deep-link/**/responsive_shim.min.css', to: 'pbdeeplink/responsive_shim.min.css'},
{from: '**/*.json', to: '[name].json', context: 'src/'}
]
})
]
}