Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- const webpack = require("webpack");
- const AsyncChunkNames = require('webpack-async-chunk-names-plugin');
- const CleanWebpackPlugin = require('clean-webpack-plugin');
- const autoprefixer = require('autoprefixer');
- const path = require('path');
- const buildPath = path.join(__dirname, 'dist');
- const appPath = path.join(__dirname, 'src');
- module.exports = {
- entry: appPath,
- optimization: {minimize: process.env.NODE_ENV === 'production'},
- resolve: {
- extensions: ['.js', '.jsx'],
- modules: ['app', 'node_modules']
- },
- output: {
- filename: 'calculator.js',
- chunkFilename: '[chunkhash].js'
- },
- plugins: [
- new AsyncChunkNames(),
- new webpack.NamedModulesPlugin(),
- new webpack.DefinePlugin({
- 'process.env.NODE_ENV': JSON.stringify('production')
- }),
- new webpack.HotModuleReplacementPlugin(),
- new CleanWebpackPlugin(buildPath, {
- root: process.cwd()
- })
- ],
- module: {
- rules: [
- {
- test: /\.(js|jsx)$/,
- exclude: /node_modules/,
- loader: 'babel-loader',
- include: appPath
- },
- {
- test: /\.(ttf|eot|svg|woff(2)?)(\?[a-z0-9=&.]+)?$/,
- use: [
- {
- loader: 'file-loader'
- }
- ],
- include: appPath
- },
- {
- test: /\.(png|jpg)$/,
- use: [
- {
- loader: 'file-loader'
- }
- ]
- }
- ]
- }
- };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement