Last active
February 3, 2018 18:02
-
-
Save bloadvenro/b45f0f64d5d9ca89fb69017725fe430e to your computer and use it in GitHub Desktop.
Webpack boilerplate stuff
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const fallbackRule: Webpack.Rule = { | |
test: function matchEverything() { | |
return true | |
}, | |
exclude: [ | |
/\.html$/, // .html files are handled by html-webpack-plugin. | |
/\.json$/ // .json files are often handled by webpack internally (i.e. hot-update.json). | |
], | |
loader: require.resolve('file-loader'), | |
options: { | |
name: '[name].[hash:8].[ext]' // Even in development mode hashing is useful. | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const entry: [ | |
'applicationEntryScript.tsx', | |
require.resolve('react-hot-loader/patch'), | |
`webpack-dev-server/client?http://${host}:${port}`, | |
'webpack/hot/only-dev-server' | |
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const module = { | |
rules: [{ | |
include: APPLICATION_SOURCE_DIR, // Scope for loaders. | |
rules: [{ | |
oneOf: [typescriptDevRule, fallbackRule] | |
}] | |
}] | |
}, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const typescriptRule: Webpack.Rule = { | |
test: /\.tsx?$/, | |
loaders: [require.resolve('react-hot-loader/webpack'), require.resolve('ts-loader')] | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment