combined separate webpack configs into one

This commit is contained in:
notnull 2019-04-05 14:17:02 -04:00
parent 4ba7e4660e
commit 77ca287153
4 changed files with 38 additions and 38 deletions

View File

@ -1,22 +0,0 @@
const path = require('path')
//const CleanWebpackPlugin = require('clean-webpack-plugin')
//const HtmlWebpackPlugin = require('html-webpack-plugin')
module.exports = {
entry: { app: ['@babel/polyfill', './src/index.js'] },
module: {
rules: [
{
test: /\.jsx?$/,
exclude: /node_modules/,
loader: 'babel-loader'
}
]
},
output: {
filename: 'bundle.js',
path: path.resolve(__dirname, 'dist')
}
}

38
webpack.config.js Normal file
View File

@ -0,0 +1,38 @@
const webpack = require('webpack')
const path = require('path')
const isDev = process.env.NODE_ENV === 'development'
module.exports = {
mode: isDev? 'development' : 'production',
entry: ['@babel/polyfill', './src/index.js'],
module: {
rules: [
{
test: /\.(js|jsx)$/,
exclude: /node_modules/,
use: ['babel-loader'],
},
],
},
resolve: {
extensions: ['*', '.js', '.jsx'],
},
output: {
path: __dirname + '/dist',
filename: 'bundle.js',
},
plugins: [new webpack.HotModuleReplacementPlugin()],
devServer: {
contentBase: path.join(__dirname, 'dist'),
hot: false,
port: 3001,
historyApiFallback: true,
allowedHosts: [
'localhost',
],
proxy: {
'/api': 'http://localhost:1337',
},
},
}

View File

@ -1,10 +0,0 @@
const merge = require('webpack-merge')
const common = require('./webpack.common.js')
module.exports = merge(common, {
mode: 'development',
devtool: 'inline-source-map',
devServer: {
contentBase: './dist'
}
})

View File

@ -1,6 +0,0 @@
const merge = require('webpack-merge')
const common = require('./webpack.common.js')
module.exports = merge(common, {
mode: 'production'
})