-
Notifications
You must be signed in to change notification settings - Fork 11
/
Copy pathwebpack.config.js
68 lines (67 loc) · 2.65 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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
const NODE_ENV = process.env.NODE_ENV || 'development';
const path = require("path");
const BundleAnalyzerPlugin = require('webpack-bundle-analyzer').BundleAnalyzerPlugin;
module.exports = {
mode: NODE_ENV,
devtool: NODE_ENV === 'development' ? 'source-map' : false,
entry: {
settingsPostTypes: "./assets/jsx/settings-post-types.jsx",
settingsGeneral: "./assets/jsx/settings-general.jsx",
blockEditor: "./assets/jsx/block-editor.jsx",
classicEditor: "./assets/jsx/classic-editor.jsx",
quickEdit: "./assets/jsx/quick-edit.jsx",
bulkEdit: "./assets/jsx/bulk-edit.jsx",
settingsAdvanced: "./assets/jsx/settings-advanced.jsx",
workflowEditor: "./assets/jsx/workflow-editor/index.jsx",
legacyAction: "./assets/jsx/legacy-action/index.jsx",
workflowManualSelectionQuickEdit: "./assets/jsx/workflow-manual-selection/quick-edit/index.jsx",
workflowManualSelectionClassicEditor: "./assets/jsx/workflow-manual-selection/classic-editor/index.jsx",
workflowManualSelectionBlockEditor: "./assets/jsx/workflow-manual-selection/block-editor/index.jsx",
workflowManualSelectionBulkEdit: "./assets/jsx/workflow-manual-selection/bulk-edit/index.jsx",
futureActions: "./assets/jsx/future-actions.jsx",
backupPanel: "./assets/jsx/backup-panel/index.jsx"
},
output: {
path: path.join(__dirname, "assets", "js"),
filename: NODE_ENV === 'production' ? "[name].min.js" : "[name].js"
},
resolve: {
extensions: ['.js', '.jsx']
},
module: {
rules: [
{
test: /\.(jsx)$/, // Identifies which file or files should be transformed.
use: {loader: "babel-loader"}, //
exclude: [
/(node_modules|bower_components)/,
]// JavaScript files to be ignored.
},
{
test: /\.css$/i,
use: ["style-loader", "css-loader", "postcss-loader"],
}
]
},
optimization: {
minimize: NODE_ENV === 'production',
},
// plugins: [
// new BundleAnalyzerPlugin({
// analyzerMode: 'static',
// reportFilename: 'webpack-bundle-stats.html',
// }),
// ],
externals: {
"react": "React",
"react-dom": "ReactDOM",
"@wordpress/element": "wp.element",
"@wordpress/components": "wp.components",
"@wordpress/data": "wp.data",
"@wordpress/plugins": "wp.plugins",
"@wordpress/hooks": "wp.hooks",
"@wordpress/url": "wp.url",
"@wordpress/i18n": "wp.i18n",
'wp': 'wp'
},
};