Skip to content

Commit c0298a5

Browse files
committed
fix webpack code style
1 parent c91d8ed commit c0298a5

File tree

1 file changed

+54
-53
lines changed

1 file changed

+54
-53
lines changed

webpack.config.js

Lines changed: 54 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -1,60 +1,61 @@
1-
const path = require("path");
2-
const mode = process.env.NODE_ENV || "production";
3-
const BundleAnalyzerPlugin = require("webpack-bundle-analyzer")
4-
.BundleAnalyzerPlugin;
1+
const path = require( 'path' );
2+
const mode = process.env.NODE_ENV || 'production';
3+
const BundleAnalyzerPlugin = require( 'webpack-bundle-analyzer' )
4+
.BundleAnalyzerPlugin;
55

66
const sharedConfig = {
7-
mode: mode,
8-
entry: {
9-
analytics: path.resolve(__dirname, "src/analytics.js"),
10-
},
11-
output: {
12-
path: path.resolve(__dirname, "build"),
13-
filename: "[name].js",
14-
publicPath: ".",
15-
libraryTarget: "this",
16-
jsonpFunction: "HManalyticsJSONP",
17-
},
18-
module: {
19-
rules: [
20-
{
21-
test: /\.m?js$/,
22-
exclude: /(node_modules|bower_components)/,
23-
use: {
24-
loader: "babel-loader",
25-
options: {
26-
presets: [
27-
require("@babel/preset-env"),
28-
require("@babel/preset-react"),
29-
],
30-
plugins: [
31-
require("@babel/plugin-transform-runtime"),
32-
require('@wordpress/babel-plugin-import-jsx-pragma'),
33-
],
34-
},
35-
},
36-
},
37-
],
38-
},
39-
optimization: {
40-
noEmitOnErrors: true,
41-
},
42-
plugins: [],
43-
devtool:
44-
mode === "production"
45-
? "cheap-module-source-map"
46-
: "cheap-module-eval-source-map",
47-
externals: {
48-
"Altis": "Altis",
49-
"wp": "wp",
50-
"react": "React",
51-
"react-dom": "ReactDOM",
52-
},
7+
mode: mode,
8+
entry: {
9+
analytics: path.resolve( __dirname, 'src/analytics.js' ),
10+
},
11+
output: {
12+
path: path.resolve( __dirname, 'build' ),
13+
filename: '[name].js',
14+
publicPath: '.',
15+
libraryTarget: 'this',
16+
jsonpFunction: 'HManalyticsJSONP',
17+
},
18+
module: {
19+
rules: [
20+
{
21+
test: /\.m?js$/,
22+
exclude: /(node_modules|bower_components)/,
23+
use: {
24+
loader: 'babel-loader',
25+
options: {
26+
presets: [
27+
require( '@babel/preset-env' ),
28+
require( '@babel/preset-react' ),
29+
],
30+
plugins: [
31+
require( '@babel/plugin-transform-runtime' ),
32+
require( '@wordpress/babel-plugin-import-jsx-pragma' ),
33+
],
34+
},
35+
},
36+
},
37+
],
38+
},
39+
optimization: {
40+
noEmitOnErrors: true,
41+
},
42+
plugins: [],
43+
devtool: (
44+
mode === 'production'
45+
? 'cheap-module-source-map'
46+
: 'cheap-module-eval-source-map'
47+
),
48+
externals: {
49+
'Altis': 'Altis',
50+
'wp': 'wp',
51+
'react': 'React',
52+
'react-dom': 'ReactDOM',
53+
},
5354
};
5455

55-
if (process.env.ANALYSE_BUNDLE) {
56-
// Add bundle analyser.
57-
sharedConfig.plugins.push(new BundleAnalyzerPlugin());
56+
if ( process.env.ANALYSE_BUNDLE ) {
57+
// Add bundle analyser.
58+
sharedConfig.plugins.push( new BundleAnalyzerPlugin() );
5859
}
5960

6061
module.exports = sharedConfig;

0 commit comments

Comments
 (0)