Skip to content

Instantly share code, notes, and snippets.

@joshuacrass
Last active September 10, 2018 11:03
Show Gist options
  • Save joshuacrass/d0991d53cf9ebf60f7dc6d407556fdfe to your computer and use it in GitHub Desktop.
Save joshuacrass/d0991d53cf9ebf60f7dc6d407556fdfe to your computer and use it in GitHub Desktop.
react-starter webpack common config file
// webpack-common-config.js
// This file will contain configuration data that
// is shared between development and production builds.
const HtmlWebpackPlugin = require("html-webpack-plugin");
const path = require("path");
const paths = require("./paths");
module.exports = {
plugins: [
new HtmlWebpackPlugin({
inject: true,
template: paths.appHtml
})
],
resolve: {
// File extensions. Add others and needed (e.g. scss, json)
extensions: [".js", ".jsx"],
modules: ["node_modules"],
// Aliases help with shortening relative paths
// 'Components/button' === '../../../components/button'
alias: {
Components: path.resolve(paths.appSrc, "components"),
Containers: path.resolve(paths.appSrc, "containers"),
Utils: path.resolve(paths.appSrc, "utils")
}
},
module: {
rules: [
{
test: /\.(png|svg|jpg)$/,
use: ["file-loader"]
}
]
}
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment