Browse code
Remove webpack
Ed Langley authored on 14/05/2019 07:55:39
Showing 3 changed files
Showing 3 changed files
1 | 1 |
deleted file mode 100644 |
... | ... |
@@ -1,380 +0,0 @@ |
1 |
-const path = require("path"); |
|
2 |
-const webpack = require("webpack"); |
|
3 |
-const PnpWebpackPlugin = require("pnp-webpack-plugin"); |
|
4 |
-const HtmlWebpackPlugin = require("html-webpack-plugin"); |
|
5 |
-const CaseSensitivePathsPlugin = require("case-sensitive-paths-webpack-plugin"); |
|
6 |
-const InlineChunkHtmlPlugin = require("react-dev-utils/InlineChunkHtmlPlugin"); |
|
7 |
-const TerserPlugin = require("terser-webpack-plugin"); |
|
8 |
-const ManifestPlugin = require("webpack-manifest-plugin"); |
|
9 |
-const InterpolateHtmlPlugin = require("react-dev-utils/InterpolateHtmlPlugin"); |
|
10 |
-const WorkboxWebpackPlugin = require("workbox-webpack-plugin"); |
|
11 |
-const WatchMissingNodeModulesPlugin = require("react-dev-utils/WatchMissingNodeModulesPlugin"); |
|
12 |
-const ModuleScopePlugin = require("react-dev-utils/ModuleScopePlugin"); |
|
13 |
-const paths = require("./paths"); |
|
14 |
-const getClientEnvironment = require("./env"); |
|
15 |
-const ModuleNotFoundPlugin = require("react-dev-utils/ModuleNotFoundPlugin"); |
|
16 |
- |
|
17 |
-// Source maps are resource heavy and can cause out of memory issue for large source files. |
|
18 |
-const shouldUseSourceMap = process.env.GENERATE_SOURCEMAP !== "false"; |
|
19 |
-// Some apps do not need the benefits of saving a web request, so not inlining the chunk |
|
20 |
-// makes for a smoother build process. |
|
21 |
-const shouldInlineRuntimeChunk = process.env.INLINE_RUNTIME_CHUNK !== "false"; |
|
22 |
- |
|
23 |
-// This is the production and development configuration. |
|
24 |
-// It is focused on developer experience, fast rebuilds, and a minimal bundle. |
|
25 |
-module.exports = function(webpackEnv) { |
|
26 |
- const isEnvDevelopment = webpackEnv === "development"; |
|
27 |
- const isEnvProduction = webpackEnv === "production"; |
|
28 |
- |
|
29 |
- // Webpack uses `publicPath` to determine where the app is being served from. |
|
30 |
- // It requires a trailing slash, or the file assets will get an incorrect path. |
|
31 |
- // In development, we always serve from the root. This makes config easier. |
|
32 |
- const publicPath = isEnvProduction |
|
33 |
- ? paths.servedPath |
|
34 |
- : isEnvDevelopment && "/"; |
|
35 |
- |
|
36 |
- // `publicUrl` is just like `publicPath`, but we will provide it to our app |
|
37 |
- // as %PUBLIC_URL% in `index.html` and `process.env.PUBLIC_URL` in JavaScript. |
|
38 |
- // Omit trailing slash as %PUBLIC_URL%/xyz looks better than %PUBLIC_URL%xyz. |
|
39 |
- const publicUrl = isEnvProduction |
|
40 |
- ? publicPath.slice(0, -1) |
|
41 |
- : isEnvDevelopment && ""; |
|
42 |
- // Get environment variables to inject into our app. |
|
43 |
- const env = getClientEnvironment(publicUrl); |
|
44 |
- |
|
45 |
- return { |
|
46 |
- mode: isEnvProduction ? "production" : isEnvDevelopment && "development", |
|
47 |
- // Stop compilation early in production |
|
48 |
- bail: isEnvProduction, |
|
49 |
- devtool: isEnvProduction |
|
50 |
- ? shouldUseSourceMap |
|
51 |
- ? "source-map" |
|
52 |
- : false |
|
53 |
- : isEnvDevelopment && "cheap-module-source-map", |
|
54 |
- // These are the "entry points" to our application. |
|
55 |
- // This means they will be the "root" imports that are included in JS bundle. |
|
56 |
- entry: [ |
|
57 |
- // Include an alternative client for WebpackDevServer. A client's job is to |
|
58 |
- // connect to WebpackDevServer by a socket and get notified about changes. |
|
59 |
- // When you save a file, the client will either apply hot updates (in case |
|
60 |
- // of CSS changes), or refresh the page (in case of JS changes). When you |
|
61 |
- // make a syntax error, this client will display a syntax error overlay. |
|
62 |
- // Note: instead of the default WebpackDevServer client, we use a custom one |
|
63 |
- // to bring better experience for Create React App users. You can replace |
|
64 |
- // the line below with these two lines if you prefer the stock client: |
|
65 |
- // require.resolve('webpack-dev-server/client') + '?/', |
|
66 |
- // require.resolve('webpack/hot/dev-server'), |
|
67 |
- isEnvDevelopment && |
|
68 |
- require.resolve("react-dev-utils/webpackHotDevClient"), |
|
69 |
- // Finally, this is your app's code: |
|
70 |
- paths.appIndexJs |
|
71 |
- // We include the app code last so that if there is a runtime error during |
|
72 |
- // initialization, it doesn't blow up the WebpackDevServer client, and |
|
73 |
- // changing JS code would still trigger a refresh. |
|
74 |
- ].filter(Boolean), |
|
75 |
- output: { |
|
76 |
- // The build folder. |
|
77 |
- path: isEnvProduction ? paths.appBuild : undefined, |
|
78 |
- // Add /* filename */ comments to generated require()s in the output. |
|
79 |
- pathinfo: isEnvDevelopment, |
|
80 |
- // There will be one main bundle, and one file per asynchronous chunk. |
|
81 |
- // In development, it does not produce real files. |
|
82 |
- filename: isEnvProduction |
|
83 |
- ? "static/js/[name].[contenthash:8].js" |
|
84 |
- : isEnvDevelopment && "static/js/bundle.js", |
|
85 |
- // There are also additional JS chunk files if you use code splitting. |
|
86 |
- chunkFilename: isEnvProduction |
|
87 |
- ? "static/js/[name].[contenthash:8].chunk.js" |
|
88 |
- : isEnvDevelopment && "static/js/[name].chunk.js", |
|
89 |
- // We inferred the "public path" (such as / or /my-project) from homepage. |
|
90 |
- // We use "/" in development. |
|
91 |
- publicPath: publicPath, |
|
92 |
- // Point sourcemap entries to original disk location (format as URL on Windows) |
|
93 |
- devtoolModuleFilenameTemplate: isEnvProduction |
|
94 |
- ? info => |
|
95 |
- path |
|
96 |
- .relative(paths.appSrc, info.absoluteResourcePath) |
|
97 |
- .replace(/\\/g, "/") |
|
98 |
- : isEnvDevelopment && |
|
99 |
- (info => path.resolve(info.absoluteResourcePath).replace(/\\/g, "/")) |
|
100 |
- }, |
|
101 |
- optimization: { |
|
102 |
- minimize: isEnvProduction, |
|
103 |
- minimizer: [ |
|
104 |
- // This is only used in production mode |
|
105 |
- new TerserPlugin({ |
|
106 |
- terserOptions: { |
|
107 |
- parse: { |
|
108 |
- // we want terser to parse ecma 8 code. However, we don't want it |
|
109 |
- // to apply any minfication steps that turns valid ecma 5 code |
|
110 |
- // into invalid ecma 5 code. This is why the 'compress' and 'output' |
|
111 |
- // sections only apply transformations that are ecma 5 safe |
|
112 |
- // https://github.com/facebook/create-react-app/pull/4234 |
|
113 |
- ecma: 8 |
|
114 |
- }, |
|
115 |
- compress: { |
|
116 |
- ecma: 5, |
|
117 |
- warnings: false, |
|
118 |
- // Disabled because of an issue with Uglify breaking seemingly valid code: |
|
119 |
- // https://github.com/facebook/create-react-app/issues/2376 |
|
120 |
- // Pending further investigation: |
|
121 |
- // https://github.com/mishoo/UglifyJS2/issues/2011 |
|
122 |
- comparisons: false, |
|
123 |
- // Disabled because of an issue with Terser breaking valid code: |
|
124 |
- // https://github.com/facebook/create-react-app/issues/5250 |
|
125 |
- // Pending futher investigation: |
|
126 |
- // https://github.com/terser-js/terser/issues/120 |
|
127 |
- inline: 2 |
|
128 |
- }, |
|
129 |
- mangle: { |
|
130 |
- safari10: true |
|
131 |
- }, |
|
132 |
- output: { |
|
133 |
- ecma: 5, |
|
134 |
- comments: false, |
|
135 |
- // Turned on because emoji and regex is not minified properly using default |
|
136 |
- // https://github.com/facebook/create-react-app/issues/2488 |
|
137 |
- ascii_only: true |
|
138 |
- } |
|
139 |
- }, |
|
140 |
- // Use multi-process parallel running to improve the build speed |
|
141 |
- // Default number of concurrent runs: os.cpus().length - 1 |
|
142 |
- parallel: true, |
|
143 |
- // Enable file caching |
|
144 |
- cache: true, |
|
145 |
- sourceMap: shouldUseSourceMap |
|
146 |
- }) |
|
147 |
- ], |
|
148 |
- // Automatically split vendor and commons |
|
149 |
- // https://twitter.com/wSokra/status/969633336732905474 |
|
150 |
- // https://medium.com/webpack/webpack-4-code-splitting-chunk-graph-and-the-splitchunks-optimization-be739a861366 |
|
151 |
- splitChunks: { |
|
152 |
- chunks: "all", |
|
153 |
- name: false |
|
154 |
- }, |
|
155 |
- // Keep the runtime chunk separated to enable long term caching |
|
156 |
- // https://twitter.com/wSokra/status/969679223278505985 |
|
157 |
- runtimeChunk: true |
|
158 |
- }, |
|
159 |
- resolve: { |
|
160 |
- // This allows you to set a fallback for where Webpack should look for modules. |
|
161 |
- // We placed these paths second because we want `node_modules` to "win" |
|
162 |
- // if there are any conflicts. This matches Node resolution mechanism. |
|
163 |
- // https://github.com/facebook/create-react-app/issues/253 |
|
164 |
- modules: ["node_modules"].concat( |
|
165 |
- // It is guaranteed to exist because we tweak it in `env.js` |
|
166 |
- process.env.NODE_PATH.split(path.delimiter).filter(Boolean) |
|
167 |
- ), |
|
168 |
- // These are the reasonable defaults supported by the Node ecosystem. |
|
169 |
- // We also include JSX as a common component filename extension to support |
|
170 |
- // some tools, although we do not recommend using it, see: |
|
171 |
- // https://github.com/facebook/create-react-app/issues/290 |
|
172 |
- // `web` extension prefixes have been added for better support |
|
173 |
- // for React Native Web. |
|
174 |
- extensions: paths.moduleFileExtensions.map(ext => `.${ext}`), |
|
175 |
- plugins: [ |
|
176 |
- // Adds support for installing with Plug'n'Play, leading to faster installs and adding |
|
177 |
- // guards against forgotten dependencies and such. |
|
178 |
- PnpWebpackPlugin, |
|
179 |
- // Prevents users from importing files from outside of src/ (or node_modules/). |
|
180 |
- // This often causes confusion because we only process files within src/ with babel. |
|
181 |
- // To fix this, we prevent you from importing files out of src/ -- if you'd like to, |
|
182 |
- // please link the files into your node_modules/ and let module-resolution kick in. |
|
183 |
- // Make sure your source files are compiled, as they will not be processed in any way. |
|
184 |
- new ModuleScopePlugin(paths.appSrc, [paths.appPackageJson]) |
|
185 |
- ] |
|
186 |
- }, |
|
187 |
- resolveLoader: { |
|
188 |
- plugins: [ |
|
189 |
- // Also related to Plug'n'Play, but this time it tells Webpack to load its loaders |
|
190 |
- // from the current package. |
|
191 |
- PnpWebpackPlugin.moduleLoader(module) |
|
192 |
- ] |
|
193 |
- }, |
|
194 |
- module: { |
|
195 |
- strictExportPresence: true, |
|
196 |
- rules: [ |
|
197 |
- // Disable require.ensure as it's not a standard language feature. |
|
198 |
- { parser: { requireEnsure: false } }, |
|
199 |
- |
|
200 |
- // First, run the linter. |
|
201 |
- // It's important to do this before Babel processes the JS. |
|
202 |
- { |
|
203 |
- test: /\.(js|mjs|jsx)$/, |
|
204 |
- enforce: "pre", |
|
205 |
- use: [ |
|
206 |
- { |
|
207 |
- options: { |
|
208 |
- formatter: require.resolve("react-dev-utils/eslintFormatter"), |
|
209 |
- eslintPath: require.resolve("eslint") |
|
210 |
- }, |
|
211 |
- loader: require.resolve("eslint-loader") |
|
212 |
- } |
|
213 |
- ], |
|
214 |
- include: paths.appSrc |
|
215 |
- }, |
|
216 |
- { |
|
217 |
- // "oneOf" will traverse all following loaders until one will |
|
218 |
- // match the requirements. When no loader matches it will fall |
|
219 |
- // back to the "file" loader at the end of the loader list. |
|
220 |
- oneOf: [ |
|
221 |
- // Process application JS with Babel. |
|
222 |
- { |
|
223 |
- test: /\.(js)$/, |
|
224 |
- include: paths.appSrc, |
|
225 |
- loader: require.resolve("babel-loader"), |
|
226 |
- options: { |
|
227 |
- plugins: [[require.resolve("babel-plugin-named-asset-import")]], |
|
228 |
- // This is a feature of `babel-loader` for webpack (not Babel itself). |
|
229 |
- // It enables caching results in ./node_modules/.cache/babel-loader/ |
|
230 |
- // directory for faster rebuilds. |
|
231 |
- cacheDirectory: true, |
|
232 |
- cacheCompression: isEnvProduction, |
|
233 |
- compact: isEnvProduction |
|
234 |
- } |
|
235 |
- }, |
|
236 |
- // Process any JS outside of the app with Babel. |
|
237 |
- // Unlike the application JS, we only compile the standard ES features. |
|
238 |
- { |
|
239 |
- test: /\.(js)$/, |
|
240 |
- exclude: /@babel(?:\/|\\{1,2})runtime/, |
|
241 |
- loader: require.resolve("babel-loader"), |
|
242 |
- options: { |
|
243 |
- babelrc: false, |
|
244 |
- configFile: false, |
|
245 |
- compact: false, |
|
246 |
- presets: [[{ helpers: true }]], |
|
247 |
- cacheDirectory: true, |
|
248 |
- cacheCompression: isEnvProduction, |
|
249 |
- |
|
250 |
- // If an error happens in a package, it's possible to be |
|
251 |
- // because it was compiled. Thus, we don't want the browser |
|
252 |
- // debugger to show the original code. Instead, the code |
|
253 |
- // being evaluated would be much more helpful. |
|
254 |
- sourceMaps: false |
|
255 |
- } |
|
256 |
- }, |
|
257 |
- // "file" loader makes sure those assets get served by WebpackDevServer. |
|
258 |
- // When you `import` an asset, you get its (virtual) filename. |
|
259 |
- // In production, they would get copied to the `build` folder. |
|
260 |
- // This loader doesn't use a "test" so it will catch all modules |
|
261 |
- // that fall through the other loaders. |
|
262 |
- { |
|
263 |
- loader: require.resolve("file-loader"), |
|
264 |
- exclude: [/\.js$/, /\.html$/, /\.json$/], |
|
265 |
- options: { |
|
266 |
- name: "static/media/[name].[hash:8].[ext]" |
|
267 |
- } |
|
268 |
- } |
|
269 |
- // ** STOP ** Are you adding a new loader? |
|
270 |
- // Make sure to add the new loader(s) before the "file" loader. |
|
271 |
- ] |
|
272 |
- } |
|
273 |
- ] |
|
274 |
- }, |
|
275 |
- plugins: [ |
|
276 |
- // Generates an `index.html` file with the <script> injected. |
|
277 |
- new HtmlWebpackPlugin( |
|
278 |
- Object.assign( |
|
279 |
- {}, |
|
280 |
- { |
|
281 |
- inject: true, |
|
282 |
- template: paths.appHtml |
|
283 |
- }, |
|
284 |
- isEnvProduction |
|
285 |
- ? { |
|
286 |
- minify: { |
|
287 |
- removeComments: true, |
|
288 |
- collapseWhitespace: true, |
|
289 |
- removeRedundantAttributes: true, |
|
290 |
- useShortDoctype: true, |
|
291 |
- removeEmptyAttributes: true, |
|
292 |
- removeStyleLinkTypeAttributes: true, |
|
293 |
- keepClosingSlash: true, |
|
294 |
- minifyJS: true, |
|
295 |
- minifyURLs: true |
|
296 |
- } |
|
297 |
- } |
|
298 |
- : undefined |
|
299 |
- ) |
|
300 |
- ), |
|
301 |
- // Inlines the webpack runtime script. This script is too small to warrant |
|
302 |
- // a network request. |
|
303 |
- isEnvProduction && |
|
304 |
- shouldInlineRuntimeChunk && |
|
305 |
- new InlineChunkHtmlPlugin(HtmlWebpackPlugin, [/runtime~.+[.]js/]), |
|
306 |
- // Makes some environment variables available in index.html. |
|
307 |
- // The public URL is available as %PUBLIC_URL% in index.html, e.g.: |
|
308 |
- // <link rel="shortcut icon" href="%PUBLIC_URL%/favicon.ico"> |
|
309 |
- // In production, it will be an empty string unless you specify "homepage" |
|
310 |
- // in `package.json`, in which case it will be the pathname of that URL. |
|
311 |
- // In development, this will be an empty string. |
|
312 |
- new InterpolateHtmlPlugin(HtmlWebpackPlugin, env.raw), |
|
313 |
- // This gives some necessary context to module not found errors, such as |
|
314 |
- // the requesting resource. |
|
315 |
- new ModuleNotFoundPlugin(paths.appPath), |
|
316 |
- // Makes some environment variables available to the JS code, for example: |
|
317 |
- // if (process.env.NODE_ENV === 'production') { ... }. See `./env.js`. |
|
318 |
- // It is absolutely essential that NODE_ENV is set to production |
|
319 |
- // during a production build. |
|
320 |
- // Otherwise React will be compiled in the very slow development mode. |
|
321 |
- new webpack.DefinePlugin(env.stringified), |
|
322 |
- // This is necessary to emit hot updates (currently CSS only): |
|
323 |
- isEnvDevelopment && new webpack.HotModuleReplacementPlugin(), |
|
324 |
- // Watcher doesn't work well if you mistype casing in a path so we use |
|
325 |
- // a plugin that prints an error when you attempt to do this. |
|
326 |
- // See https://github.com/facebook/create-react-app/issues/240 |
|
327 |
- isEnvDevelopment && new CaseSensitivePathsPlugin(), |
|
328 |
- // If you require a missing module and then `npm install` it, you still have |
|
329 |
- // to restart the development server for Webpack to discover it. This plugin |
|
330 |
- // makes the discovery automatic so you don't have to restart. |
|
331 |
- // See https://github.com/facebook/create-react-app/issues/186 |
|
332 |
- isEnvDevelopment && |
|
333 |
- new WatchMissingNodeModulesPlugin(paths.appNodeModules), |
|
334 |
- // Generate a manifest file which contains a mapping of all asset filenames |
|
335 |
- // to their corresponding output file so that tools can pick it up without |
|
336 |
- // having to parse `index.html`. |
|
337 |
- new ManifestPlugin({ |
|
338 |
- fileName: "asset-manifest.json", |
|
339 |
- publicPath: publicPath |
|
340 |
- }), |
|
341 |
- // Moment.js is an extremely popular library that bundles large locale files |
|
342 |
- // by default due to how Webpack interprets its code. This is a practical |
|
343 |
- // solution that requires the user to opt into importing specific locales. |
|
344 |
- // https://github.com/jmblog/how-to-optimize-momentjs-with-webpack |
|
345 |
- // You can remove this if you don't use Moment.js: |
|
346 |
- new webpack.IgnorePlugin(/^\.\/locale$/, /moment$/), |
|
347 |
- // Generate a service worker script that will precache, and keep up to date, |
|
348 |
- // the HTML & assets that are part of the Webpack build. |
|
349 |
- isEnvProduction && |
|
350 |
- new WorkboxWebpackPlugin.GenerateSW({ |
|
351 |
- clientsClaim: true, |
|
352 |
- exclude: [/\.map$/, /asset-manifest\.json$/], |
|
353 |
- importWorkboxFrom: "cdn", |
|
354 |
- navigateFallback: publicUrl + "/index.html", |
|
355 |
- navigateFallbackBlacklist: [ |
|
356 |
- // Exclude URLs starting with /_, as they're likely an API call |
|
357 |
- new RegExp("^/_"), |
|
358 |
- // Exclude URLs containing a dot, as they're likely a resource in |
|
359 |
- // public/ and not a SPA route |
|
360 |
- new RegExp("/[^/]+\\.[^/]+$") |
|
361 |
- ] |
|
362 |
- }) |
|
363 |
- // TypeScript type checking |
|
364 |
- ].filter(Boolean), |
|
365 |
- // Some libraries import Node modules but don't use them in the browser. |
|
366 |
- // Tell Webpack to provide empty mocks for them so importing them works. |
|
367 |
- node: { |
|
368 |
- module: "empty", |
|
369 |
- dgram: "empty", |
|
370 |
- dns: "mock", |
|
371 |
- fs: "empty", |
|
372 |
- net: "empty", |
|
373 |
- tls: "empty", |
|
374 |
- child_process: "empty" |
|
375 |
- }, |
|
376 |
- // Turn off performance processing because we utilize |
|
377 |
- // our own hints via the FileSizeReporter |
|
378 |
- performance: false |
|
379 |
- }; |
|
380 |
-}; |
381 | 0 |
deleted file mode 100644 |
... | ... |
@@ -1,102 +0,0 @@ |
1 |
-const errorOverlayMiddleware = require("react-dev-utils/errorOverlayMiddleware"); |
|
2 |
-const evalSourceMapMiddleware = require("react-dev-utils/evalSourceMapMiddleware"); |
|
3 |
-const noopServiceWorkerMiddleware = require("react-dev-utils/noopServiceWorkerMiddleware"); |
|
4 |
-const ignoredFiles = require("react-dev-utils/ignoredFiles"); |
|
5 |
-const paths = require("./paths"); |
|
6 |
-const fs = require("fs"); |
|
7 |
- |
|
8 |
-const protocol = process.env.HTTPS === "true" ? "https" : "http"; |
|
9 |
-const host = process.env.HOST || "0.0.0.0"; |
|
10 |
- |
|
11 |
-module.exports = function(proxy, allowedHost) { |
|
12 |
- return { |
|
13 |
- // WebpackDevServer 2.4.3 introduced a security fix that prevents remote |
|
14 |
- // websites from potentially accessing local content through DNS rebinding: |
|
15 |
- // https://github.com/webpack/webpack-dev-server/issues/887 |
|
16 |
- // https://medium.com/webpack/webpack-dev-server-middleware-security-issues-1489d950874a |
|
17 |
- // However, it made several existing use cases such as development in cloud |
|
18 |
- // environment or subdomains in development significantly more complicated: |
|
19 |
- // https://github.com/facebook/create-react-app/issues/2271 |
|
20 |
- // https://github.com/facebook/create-react-app/issues/2233 |
|
21 |
- // While we're investigating better solutions, for now we will take a |
|
22 |
- // compromise. Since our WDS configuration only serves files in the `public` |
|
23 |
- // folder we won't consider accessing them a vulnerability. However, if you |
|
24 |
- // use the `proxy` feature, it gets more dangerous because it can expose |
|
25 |
- // remote code execution vulnerabilities in backends like Django and Rails. |
|
26 |
- // So we will disable the host check normally, but enable it if you have |
|
27 |
- // specified the `proxy` setting. Finally, we let you override it if you |
|
28 |
- // really know what you're doing with a special environment variable. |
|
29 |
- disableHostCheck: |
|
30 |
- !proxy || process.env.DANGEROUSLY_DISABLE_HOST_CHECK === "true", |
|
31 |
- // Enable gzip compression of generated files. |
|
32 |
- compress: true, |
|
33 |
- // Silence WebpackDevServer's own logs since they're generally not useful. |
|
34 |
- // It will still show compile warnings and errors with this setting. |
|
35 |
- clientLogLevel: "none", |
|
36 |
- // By default WebpackDevServer serves physical files from current directory |
|
37 |
- // in addition to all the virtual build products that it serves from memory. |
|
38 |
- // This is confusing because those files won’t automatically be available in |
|
39 |
- // production build folder unless we copy them. However, copying the whole |
|
40 |
- // project directory is dangerous because we may expose sensitive files. |
|
41 |
- // Instead, we establish a convention that only files in `public` directory |
|
42 |
- // get served. Our build script will copy `public` into the `build` folder. |
|
43 |
- // In `index.html`, you can get URL of `public` folder with %PUBLIC_URL%: |
|
44 |
- // <link rel="shortcut icon" href="%PUBLIC_URL%/favicon.ico"> |
|
45 |
- // In JavaScript code, you can access it with `process.env.PUBLIC_URL`. |
|
46 |
- // Note that we only recommend to use `public` folder as an escape hatch |
|
47 |
- // for files like `favicon.ico`, `manifest.json`, and libraries that are |
|
48 |
- // for some reason broken when imported through Webpack. If you just want to |
|
49 |
- // use an image, put it in `src` and `import` it from JavaScript instead. |
|
50 |
- contentBase: paths.appPublic, |
|
51 |
- // By default files from `contentBase` will not trigger a page reload. |
|
52 |
- watchContentBase: true, |
|
53 |
- // Enable hot reloading server. It will provide /sockjs-node/ endpoint |
|
54 |
- // for the WebpackDevServer client so it can learn when the files were |
|
55 |
- // updated. The WebpackDevServer client is included as an entry point |
|
56 |
- // in the Webpack development configuration. Note that only changes |
|
57 |
- // to CSS are currently hot reloaded. JS changes will refresh the browser. |
|
58 |
- hot: true, |
|
59 |
- // It is important to tell WebpackDevServer to use the same "root" path |
|
60 |
- // as we specified in the config. In development, we always serve from /. |
|
61 |
- publicPath: "/", |
|
62 |
- // WebpackDevServer is noisy by default so we emit custom message instead |
|
63 |
- // by listening to the compiler events with `compiler.hooks[...].tap` calls above. |
|
64 |
- quiet: true, |
|
65 |
- // Reportedly, this avoids CPU overload on some systems. |
|
66 |
- // https://github.com/facebook/create-react-app/issues/293 |
|
67 |
- // src/node_modules is not ignored to support absolute imports |
|
68 |
- // https://github.com/facebook/create-react-app/issues/1065 |
|
69 |
- watchOptions: { |
|
70 |
- ignored: ignoredFiles(paths.appSrc) |
|
71 |
- }, |
|
72 |
- // Enable HTTPS if the HTTPS environment variable is set to 'true' |
|
73 |
- https: protocol === "https", |
|
74 |
- host, |
|
75 |
- overlay: false, |
|
76 |
- historyApiFallback: { |
|
77 |
- // Paths with dots should still use the history fallback. |
|
78 |
- // See https://github.com/facebook/create-react-app/issues/387. |
|
79 |
- disableDotRule: true |
|
80 |
- }, |
|
81 |
- public: allowedHost, |
|
82 |
- proxy, |
|
83 |
- before(app, server) { |
|
84 |
- if (fs.existsSync(paths.proxySetup)) { |
|
85 |
- // This registers user provided middleware for proxy reasons |
|
86 |
- require(paths.proxySetup)(app); |
|
87 |
- } |
|
88 |
- |
|
89 |
- // This lets us fetch source contents from webpack for the error overlay |
|
90 |
- app.use(evalSourceMapMiddleware(server)); |
|
91 |
- // This lets us open files from the runtime error overlay. |
|
92 |
- app.use(errorOverlayMiddleware()); |
|
93 |
- |
|
94 |
- // This service worker file is effectively a 'no-op' that will reset any |
|
95 |
- // previous service worker registered for the same host:port combination. |
|
96 |
- // We do this in development to avoid hitting the production cache if |
|
97 |
- // it used the same host and port. |
|
98 |
- // https://github.com/facebook/create-react-app/issues/2272#issuecomment-302832432 |
|
99 |
- app.use(noopServiceWorkerMiddleware()); |
|
100 |
- } |
|
101 |
- }; |
|
102 |
-}; |
... | ... |
@@ -38,7 +38,6 @@ |
38 | 38 |
"babel-jest": "23.6.0", |
39 | 39 |
"babel-plugin-named-asset-import": "^0.3.1", |
40 | 40 |
"bfj": "6.1.1", |
41 |
- "case-sensitive-paths-webpack-plugin": "2.2.0", |
|
42 | 41 |
"dotenv": "6.0.0", |
43 | 42 |
"dotenv-expand": "4.2.0", |
44 | 43 |
"enzyme": "^3.6.0", |
... | ... |
@@ -47,7 +46,6 @@ |
47 | 46 |
"eslint": "5.12.0", |
48 | 47 |
"eslint-plugin-flowtype": "2.50.1", |
49 | 48 |
"eslint-plugin-import": "2.14.0", |
50 |
- "eslint-plugin-jsx-a11y": "6.1.2", |
|
51 | 49 |
"eslint-plugin-react": "7.12.4", |
52 | 50 |
"flow": "^0.2.3", |
53 | 51 |
"flow-bin": "^0.82.0", |
... | ... |
@@ -57,7 +55,6 @@ |
57 | 55 |
"jest-pnp-resolver": "1.0.2", |
58 | 56 |
"jest-resolve": "23.6.0", |
59 | 57 |
"jest-watch-typeahead": "^0.2.1", |
60 |
- "mini-css-extract-plugin": "0.5.0", |
|
61 | 58 |
"node": "^10.15.3", |
62 | 59 |
"prettier": "^1.17.1", |
63 | 60 |
"react": "^16.5.2", |
... | ... |
@@ -121,7 +118,9 @@ |
121 | 118 |
"eslintConfig": { |
122 | 119 |
"extends": [ |
123 | 120 |
"eslint:recommended", |
124 |
- "plugin:react/recommended" |
|
121 |
+ "plugin:react/recommended", |
|
122 |
+ "plugin:import/errors", |
|
123 |
+ "plugin:import/warnings" |
|
125 | 124 |
], |
126 | 125 |
"env": { |
127 | 126 |
"browser": true, |