Skip to content

Instantly share code, notes, and snippets.

@chnbohwr
Created March 21, 2018 03:12
Show Gist options
  • Save chnbohwr/5742b45654aa8b3bd590ed8a0a0a18ff to your computer and use it in GitHub Desktop.
Save chnbohwr/5742b45654aa8b3bd590ed8a0a0a18ff to your computer and use it in GitHub Desktop.
webpack4 base config
const path = require('path');
const HtmlWebPackPlugin = require("html-webpack-plugin");
module.exports = {
module: {
rules: [
{
test: /\.js$/,
exclude: /node_modules/,
use: ['babel-loader']
},
{
test: /\.css$/,
use: [
'style-loader',
'css-loader',
'postcss-loader'
]
},
{
test: /\.less$/,
use: [
'style-loader',
'css-loader',
'postcss-loader',
'less-loader'
]
},
{
test: /\.(png|jpg|gif|mp4|ogg|svg|woff|woff2|ttf|eot)$/,
loader: 'file-loader'
},
]
},
resolve: {
alias: {
components: path.resolve(__dirname, 'src/components/'),
containers: path.resolve(__dirname, 'src/containers/'),
static: path.resolve(__dirname, 'src/static/'),
theme: path.resolve(__dirname, 'src/theme/'),
},
extensions: [
'.js',
'.jsx'
],
modules: [
path.resolve(__dirname, 'src/'),
path.resolve(__dirname, 'node_modules/'),
]
},
plugins: [
new HtmlWebPackPlugin({
template: path.resolve(__dirname, 'src/index.html'),
filename: "./index.html"
})
]
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment