Skip to content

Commit

Permalink
add example prod. config. (webpack)
Browse files Browse the repository at this point in the history
  • Loading branch information
carloluis committed Apr 24, 2018
1 parent 3adc243 commit 633e9d8
Showing 1 changed file with 62 additions and 0 deletions.
62 changes: 62 additions & 0 deletions config/webpack.config.page.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
'use strict';

const HtmlWebpackPlugin = require('html-webpack-plugin');
const CopyWebpackPlugin = require('copy-webpack-plugin');
const webpack = require('webpack');
const path = require('path');

const PATHS = {
example: path.join(__dirname, '../example'),
dist: path.join(__dirname, '../dist')
};

module.exports = {
mode: 'production',
entry: {
app: PATHS.example
},
output: {
filename: '[name].[chunkhash].js',
sourceMapFilename: '[file].map',
path: PATHS.dist,
publicPath: './'
},
optimization: {
splitChunks: {
cacheGroups: {
vendors: {
test: /[\\/]node_modules[\\/]/,
name: 'vendors',
enforce: true,
chunks: 'all'
}
}
}
},
module: {
rules: [
{
test: /\.js$/,
exclude: /node_modules/,
loader: 'babel-loader'
}
]
},
plugins: [
new HtmlWebpackPlugin({
template: path.join(PATHS.example, 'index.html'),
filename: 'index.html',
inject: 'body'
}),
new CopyWebpackPlugin([
{
from: path.join(PATHS.example, 'favicon.ico'),
to: path.join(PATHS.dist, 'favicon.ico')
}
])
],
resolve: {
extensions: ['.js', '.jsx']
},
devtool: 'source-map'
};

0 comments on commit 633e9d8

Please sign in to comment.