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