Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- const path = require('path');
- const webpack = require('webpack');
- const BrowserSyncPlugin = require('browser-sync-webpack-plugin');
- const MiniCssExtractPlugin = require("mini-css-extract-plugin");
- const OptimizeCssAssetsPlugin = require('optimize-css-assets-webpack-plugin');
- const CleanWebpackPlugin = require('clean-webpack-plugin');
- module.exports = {
- entry: {
- main: './src/features/main/index.js',
- admin: './src/features/admin/index.js'
- },
- output: {
- filename: '[name].entry.js',
- path: path.resolve(__dirname, 'public/dist')
- },
- module: {
- rules: [
- {
- test: /\.js$/,
- exclude: /node_modules/,
- loader: "eslint-loader"
- },
- {
- test: /\.css$/,
- exclude: /node_modules/,
- use: [
- {
- loader: MiniCssExtractPlugin.loader
- },
- 'css-loader',
- 'postcss-loader'
- ]
- }
- ]
- },
- plugins: [
- new MiniCssExtractPlugin({
- filename: "[name].css"
- }),
- new CleanWebpackPlugin(),
- new OptimizeCssAssetsPlugin({
- assetNameRegExp: /\.css$/g,
- cssProcessor: require('cssnano'),
- cssProcessorPluginOptions: {
- preset: ['default', { discardComments: { removeAll: true } }]
- },
- canPrint: true
- }),
- new webpack.ProvidePlugin({
- $: 'jquery',
- jQuery: 'jquery',
- 'window.jQuery': 'jquery'
- }),
- new BrowserSyncPlugin({
- proxy: 'localhost:8000',
- host: 'localhost',
- port: 3000,
- files: ['./src/*'],
- injectChanges: true
- })
- ]
- };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement