Skip to content

Instantly share code, notes, and snippets.

@Acksop
Created November 30, 2019 14:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Acksop/9ba4bfc40ab3996d95cd4b9d3ae1546b to your computer and use it in GitHub Desktop.
Save Acksop/9ba4bfc40ab3996d95cd4b9d3ae1546b to your computer and use it in GitHub Desktop.
const webpack = require('webpack');
const path = require('path');
const HtmlWebpackPlugin = require('html-webpack-plugin');
const config = {
entry: {
app: './src/entry-point.js',
},
output: {
path: path.resolve(__dirname, 'dist'),
filename: 'js/[name].js',
},
plugins: [
new HtmlWebpackPlugin(
{
inject: true,
hash: false,
filename: 'index.html',
template: path.resolve(__dirname, 'src', 'index.html')
},
)
],
module: {
rules: [
{
test: /\.css$/i,
use: [
// style-loader
{
loader: 'style-loader',
options: {
injectType: 'singletonStyleTag'
}
},
'css-loader'
]
},
{
test: /\.lazy\.css$/i,
use: [
{
loader: 'style-loader',
options: {
injectType: 'lazyStyleTag'
}
},
'css-loader'
],
},
{
test: /\.link\.css$/i,
use: [
// style-loader
{
loader: 'style-loader' ,
options: {
injectType: 'linkTag'
}
},
'css-loader'
]
},
{
test: /\.(ttf|eot|svg|png|woff(2)?)(\?[a-z0-9]+)?$/,
use: [{
loader: 'file-loader', options: {name: './fonts/[name].[ext]',context: 'project',}
}]
}
],
}
};
module.exports = config;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment