Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- const path = require('path')
- // Plugins
- const HtmlWebpackPlugin = require('html-webpack-plugin');
- const ExtractTextPlugin = require("extract-text-webpack-plugin");
- module.exports = {
- entry: {
- index: './src/js/index.js'
- },
- output: {
- filename: '[name].bundle.js',
- path: path.join(__dirname, 'dist/js')
- },
- watchOptions: {
- ignored: /node_modules/
- },
- module: {
- rules: [
- {
- test: /\.css$/,
- exclude: /node_modules/,
- use: ExtractTextPlugin.extract({
- fallback: 'style-loader',
- use: [
- {
- loader: 'css-loader',
- options: { importLoaders: 1 }
- },
- 'postcss-loader'
- ]
- })
- },
- {
- test: /\.js$/,
- exclude: /node_modules/,
- use: [
- {
- loader: 'babel-loader',
- options: { presets: ['env'] }
- }
- ]
- },
- {
- test: /\.pug$/,
- exclude: /node_modules/,
- use: 'pug-loader'
- }
- ]
- },
- plugins: [
- new ExtractTextPlugin('../css/[name].bundle.css'),
- new HtmlWebpackPlugin({
- filename: '../index.html',
- template: 'src/index.pug',
- chunks: ['index'],
- hash: true
- })
- ]
- }
Advertisement
Add Comment
Please, Sign In to add comment