webpack: remove dynamic import (#982)

Summary:
This import does not need to be dynamic; the fact that it is loses us
safety for no benefit. (When I originally wrote it, it was less
obviously bad, but the surrounding code has changed over time.)

Test Plan:
Running `yarn flow` suffices, and now actually checks this module
instead of typing it as `any`. Running `yarn test --full` is nice, too.

wchargin-branch: webpack-remove-dynamic-import
This commit is contained in:
William Chargin 2018-11-01 13:24:31 -07:00 committed by GitHub
parent a9db2b0919
commit 415210b772
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 3 deletions

View File

@ -15,7 +15,6 @@ module.exports = {
appBuild: resolveApp("build"), appBuild: resolveApp("build"),
appIndexJs: resolveApp("src/homepage/index.js"), appIndexJs: resolveApp("src/homepage/index.js"),
appServerSideRenderingIndexJs: resolveApp("src/homepage/server.js"), appServerSideRenderingIndexJs: resolveApp("src/homepage/server.js"),
appRouteData: resolveApp("src/homepage/routeData.js"),
appPackageJson: resolveApp("package.json"), appPackageJson: resolveApp("package.json"),
appSrc: resolveApp("src"), appSrc: resolveApp("src"),
yarnLockFile: resolveApp("yarn.lock"), yarnLockFile: resolveApp("yarn.lock"),

View File

@ -221,8 +221,9 @@ function plugins(mode /*: "development" | "production" */) {
const basePlugins = [ const basePlugins = [
new StaticSiteGeneratorPlugin({ new StaticSiteGeneratorPlugin({
entry: "ssr", entry: "ssr",
// $ExpectFlowError(dynamic require) paths: require("../src/homepage/routeData").routeData.map(
paths: require(paths.appRouteData).routeData.map(({path}) => path), ({path}) => path
),
locals: {}, locals: {},
}), }),
new CopyPlugin([{from: paths.favicon, to: "favicon.png"}]), new CopyPlugin([{from: paths.favicon, to: "favicon.png"}]),