@@ -34,7 +34,7 @@ var publicUrl = '/my-custom-url';
34
34
module .exports = {
35
35
output: {
36
36
// ...
37
- publicPath: publicUrl + ' /'
37
+ publicPath: publicUrl + ' /' ,
38
38
},
39
39
// ...
40
40
plugins: [
@@ -45,18 +45,17 @@ module.exports = {
45
45
}),
46
46
// Makes the public URL available as %PUBLIC_URL% in index.html, e.g.:
47
47
// <link rel="shortcut icon" href="%PUBLIC_URL%/favicon.ico">
48
- new InterpolateHtmlPlugin ({
49
- PUBLIC_URL : publicUrl
48
+ new InterpolateHtmlPlugin (HtmlWebpackPlugin, {
49
+ PUBLIC_URL : publicUrl,
50
50
// You can pass any key-value pairs, this was just an example.
51
51
// WHATEVER: 42 will replace %WHATEVER% with 42 in index.html.
52
52
}),
53
53
// ...
54
54
],
55
55
// ...
56
- }
56
+ };
57
57
```
58
58
59
-
60
59
#### ` new ModuleScopePlugin(appSrc: string | string[], allowedFiles?: string[]) `
61
60
62
61
This Webpack plugin ensures that relative imports from app's source directories don't reach outside of it.
@@ -65,7 +64,6 @@ This Webpack plugin ensures that relative imports from app's source directories
65
64
var path = require (' path' );
66
65
var ModuleScopePlugin = require (' react-dev-utils/ModuleScopePlugin' );
67
66
68
-
69
67
module .exports = {
70
68
// ...
71
69
resolve: {
@@ -77,7 +75,7 @@ module.exports = {
77
75
// ...
78
76
},
79
77
// ...
80
- }
78
+ };
81
79
```
82
80
83
81
#### ` new WatchMissingNodeModulesPlugin(nodeModulesPath: string) `
@@ -99,10 +97,10 @@ module.exports = {
99
97
// to restart the development server for Webpack to discover it. This plugin
100
98
// makes the discovery automatic so you don't have to restart.
101
99
// See https://github.com/facebook/create-react-app/issues/186
102
- new WatchMissingNodeModulesPlugin (path .resolve (' node_modules' ))
100
+ new WatchMissingNodeModulesPlugin (path .resolve (' node_modules' )),
103
101
],
104
102
// ...
105
- }
103
+ };
106
104
```
107
105
108
106
#### ` checkRequiredFiles(files: Array<string>): boolean `
@@ -115,10 +113,12 @@ If a file is not found, prints a warning message and returns `false`.
115
113
var path = require (' path' );
116
114
var checkRequiredFiles = require (' react-dev-utils/checkRequiredFiles' );
117
115
118
- if (! checkRequiredFiles ([
119
- path .resolve (' public/index.html' ),
120
- path .resolve (' src/index.js' )
121
- ])) {
116
+ if (
117
+ ! checkRequiredFiles ([
118
+ path .resolve (' public/index.html' ),
119
+ path .resolve (' src/index.js' ),
120
+ ])
121
+ ) {
122
122
process .exit (1 );
123
123
}
124
124
```
@@ -145,22 +145,22 @@ const eslintFormatter = require('react-dev-utils/eslintFormatter');
145
145
// In your webpack config:
146
146
// ...
147
147
module: {
148
- rules: [
149
- {
150
- test: / \. (js| jsx)$ / ,
151
- include: paths .appSrc ,
152
- enforce: ' pre' ,
153
- use: [
154
- {
155
- loader: ' eslint-loader' ,
156
- options: {
157
- // Pass the formatter:
158
- formatter: eslintFormatter,
159
- },
148
+ rules: [
149
+ {
150
+ test: / \. (js| jsx)$ / ,
151
+ include: paths .appSrc ,
152
+ enforce: ' pre' ,
153
+ use: [
154
+ {
155
+ loader: ' eslint-loader' ,
156
+ options: {
157
+ // Pass the formatter:
158
+ formatter: eslintFormatter,
160
159
},
161
- ],
162
- }
163
- ]
160
+ },
161
+ ],
162
+ },
163
+ ];
164
164
}
165
165
```
166
166
@@ -264,7 +264,6 @@ Attempts to open the browser with a given URL.<br>
264
264
On Mac OS X, attempts to reuse an existing Chrome tab via AppleScript.<br >
265
265
Otherwise, falls back to [ opn] ( https://github.com/sindresorhus/opn ) behavior.
266
266
267
-
268
267
``` js
269
268
var path = require (' path' );
270
269
var openBrowser = require (' react-dev-utils/openBrowser' );
@@ -321,10 +320,10 @@ module.exports = {
321
320
// require.resolve('webpack-dev-server/client') + '?/',
322
321
// require.resolve('webpack/hot/dev-server'),
323
322
' react-dev-utils/webpackHotDevClient' ,
324
- ' src/index'
323
+ ' src/index' ,
325
324
],
326
325
// ...
327
- }
326
+ };
328
327
```
329
328
330
329
#### ` getCSSModuleLocalIdent(context: Object, localIdentName: String, localName: String, options: Object): string `
@@ -340,7 +339,7 @@ const getCSSModuleLocalIdent = require('react-dev-utils/getCSSModuleLocalIdent')
340
339
// In your webpack config:
341
340
// ...
342
341
module: {
343
- rules: [
342
+ rules: [
344
343
{
345
344
test: / \. module\. css$ / ,
346
345
use: [
@@ -358,8 +357,7 @@ module: {
358
357
options: postCSSLoaderOptions,
359
358
},
360
359
],
361
- }
362
- ]
360
+ },
361
+ ];
363
362
}
364
363
```
365
-
0 commit comments