Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- const fs = require('fs'),
- path = require('path'),
- webpack = require('webpack'),
- HtmlWebpackPlugin = require('html-webpack-plugin'),
- WebpackCleanupPlugin = require('webpack-cleanup-plugin'),
- BUILD_DIR = path.resolve(__dirname, 'build'),
- APP_DIR = path.resolve(__dirname, 'app'),
- ENV = process.env.NODE_ENV || 'development',
- PROD = ENV === 'production'
- module.exports = {
- devtool: 'source-map',
- entry: path.resolve(APP_DIR, 'index'),
- output: {
- path: BUILD_DIR,
- filename: 'bundle.js'
- },
- resolve: {
- modules: [
- 'node_modules',
- APP_DIR
- ],
- extensions: ['', '.js', '.jsx']
- },
- module: {
- rules: [
- {
- test: /\.jsx?$/,
- loader: 'babel-loader',
- exlude: /node_modules/,
- loader: 'babel-loader'
- }
- ]
- },
- plugins: [
- new HtmlWebpackPlugin({
- template: path.resolve(APP_DIR, 'index.tpl.html'),
- minify: {
- collapseWhitespace: true
- }
- }),
- new webpack.DefinePlugin({
- 'process.env': {
- 'NODE_ENV': JSON.stringify(ENV)
- }
- })
- ]
- }
Advertisement
Add Comment
Please, Sign In to add comment