Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- const path = require('path');
- const webpack = require('webpack');
- const HtmlWebpackPlugin = require('html-webpack-plugin');
- module.exports = {
- entry: {
- main: './src/components/index.js'
- },
- output: {
- path: path.resolve(__dirname, 'dist'),
- filename: 'static/js/[name].[contenthash:8].js'
- },
- module: {
- rules: [
- {
- test: /\.(js|jsx)$/,
- loader: 'babel-loader',
- options: {
- cacheDirectory: true,
- cacheCompression: false,
- babelrc: true
- }
- },
- { test: /\.json$/, loader: 'json-loader' },
- {
- test: /\.css$/,
- use: [
- 'style-loader',
- 'css-loader'
- ]
- },
- {
- exclude: [/\.(js|jsx)$/, /.html$/, /.css$/, /.json$/],
- loader: 'file-loader',
- options: {
- name: 'static/media/[name].[contenthash:8].[ext]'
- }
- }
- ]
- },
- resolve: {
- unsafeCache: true,
- extensions: ['.js', '.jsx', '.json', '.css'],
- alias: {
- actions: path.resolve(__dirname, './src/actions'),
- reducers: path.resolve(__dirname, './src/reducers'),
- components: path.resolve(__dirname, './src/components'),
- lib: path.resolve(__dirname, './src/components/_lib'),
- styles: path.resolve(__dirname, './src/styles'),
- config: path.resolve(__dirname, './src/config')
- }
- },
- plugins: [
- new HtmlWebpackPlugin({
- template: './src/public/index.html',
- favicon: './src/public/favicon.ico'
- }),
- new webpack.PrefetchPlugin('react'),
- new webpack.PrefetchPlugin('react-dom')
- ],
- optimization: {
- usedExports: true
- }
- };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement