Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
let path = require('path'),
HtmlWebpackPlugin = require('html-webpack-plugin'),
ExtractTextPlugin = require('extract-text-webpack-plugin'),
webpack = require('webpack');
module.exports = {
entry: './src/entry',
output: {
filename: 'bundle.js',
path: path.resolve(__dirname, 'dist'),
/*publicPath: '/'*/
},
module: {
rules: [
{
test: /\.ejs$/,
use: [
{
loader: "file-loader",
options: {
name: "[name].html",
},
},
"extract-loader",
{
loader: "html-loader",
options: {
attrs: ['img:src', 'link:href'],
removeComments: true,
},
},
"ejs-html-loader"
]
},
{
test: /\.css$/,
/*use: [
{
loader: 'file-loader',
options: {
outputPath: 'css/'
}
},
'extract-loader',
'css-loader',
'resolve-url-loader'
]*/
use: ExtractTextPlugin.extract({
fallback: 'style-loader',
use: [
/*{
loader: 'file-loader',
options: {
outputPath: 'css/'
}
},*/
{
loader: 'css-loader',
}
]
})
},
{
test: /\.(png|jpg|gif)$/,
use: {
loader: 'url-loader',
options: {
limit: 8192,
outputPath: './img/'
}
}
},
{
test: /\.(woff|woff2|eot|ttf|otf)$/,
use: {
loader: 'file-loader'
}
}
],
},
plugins: [
new ExtractTextPlugin('css/[name].css');
]
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.