mirror of
https://github.com/status-im/sourcecred.git
synced 2025-01-13 22:25:47 +00:00
new-webpack: add Flow typing (#563)
Summary: There really should be an `// $ExpectFlowError` on the dynamic `require` on line 182: ```js paths: require(paths.appRouteData).routeData.map(({path}) => path), ``` However, for some reason Flow does not catch this error now, so adding a suppression comment generates an “unused suppression” warning. We therefore omit the suppression in this commit; we will add it later, once Flow magically finds the error. Test Plan: `yarn flow` reports no errors; a deliberately introduced error is properly caught. wchargin-branch: webpack-flow
This commit is contained in:
parent
8dec3aa61b
commit
e2a94c2aa8
@ -1,4 +1,4 @@
|
|||||||
// @no-flow
|
// @flow
|
||||||
const path = require("path");
|
const path = require("path");
|
||||||
const webpack = require("webpack");
|
const webpack = require("webpack");
|
||||||
const ManifestPlugin = require("webpack-manifest-plugin");
|
const ManifestPlugin = require("webpack-manifest-plugin");
|
||||||
@ -52,7 +52,21 @@ module.exports = {
|
|||||||
// We inferred the "public path" (such as / or /my-project) from homepage.
|
// We inferred the "public path" (such as / or /my-project) from homepage.
|
||||||
publicPath: publicPath,
|
publicPath: publicPath,
|
||||||
// Point sourcemap entries to original disk location (format as URL on Windows)
|
// Point sourcemap entries to original disk location (format as URL on Windows)
|
||||||
devtoolModuleFilenameTemplate: (info) =>
|
devtoolModuleFilenameTemplate: (
|
||||||
|
info /*:
|
||||||
|
{|
|
||||||
|
// https://webpack.js.org/configuration/output/#output-devtoolmodulefilenametemplate
|
||||||
|
+absoluteResourcePath: string,
|
||||||
|
+allLoaders: string,
|
||||||
|
+hash: string,
|
||||||
|
+id: string,
|
||||||
|
+loaders: string,
|
||||||
|
+resource: string,
|
||||||
|
+resourcePath: string,
|
||||||
|
+namespace: string,
|
||||||
|
|}
|
||||||
|
*/
|
||||||
|
) =>
|
||||||
path
|
path
|
||||||
.relative(paths.appSrc, info.absoluteResourcePath)
|
.relative(paths.appSrc, info.absoluteResourcePath)
|
||||||
.replace(/\\/g, "/"),
|
.replace(/\\/g, "/"),
|
||||||
@ -64,10 +78,11 @@ module.exports = {
|
|||||||
// We placed these paths second because we want `node_modules` to "win"
|
// We placed these paths second because we want `node_modules` to "win"
|
||||||
// if there are any conflicts. This matches Node resolution mechanism.
|
// if there are any conflicts. This matches Node resolution mechanism.
|
||||||
// https://github.com/facebookincubator/create-react-app/issues/253
|
// https://github.com/facebookincubator/create-react-app/issues/253
|
||||||
modules: ["node_modules", paths.appNodeModules].concat(
|
modules: [
|
||||||
// It is guaranteed to exist because we tweak it in `env.js`
|
"node_modules",
|
||||||
process.env.NODE_PATH.split(path.delimiter).filter(Boolean)
|
paths.appNodeModules,
|
||||||
),
|
...(process.env.NODE_PATH || "").split(path.delimiter).filter(Boolean),
|
||||||
|
],
|
||||||
// These are the reasonable defaults supported by the Node ecosystem.
|
// These are the reasonable defaults supported by the Node ecosystem.
|
||||||
// We also include JSX as a common component filename extension to support
|
// We also include JSX as a common component filename extension to support
|
||||||
// some tools, although we do not recommend using it, see:
|
// some tools, although we do not recommend using it, see:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user