Created
November 30, 2019 14:25
-
-
Save Acksop/9ba4bfc40ab3996d95cd4b9d3ae1546b to your computer and use it in GitHub Desktop.
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 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