combined separate webpack configs into one
This commit is contained in:
parent
4ba7e4660e
commit
77ca287153
@ -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
38
webpack.config.js
Normal 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',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
@ -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'
|
|
||||||
}
|
|
||||||
})
|
|
@ -1,6 +0,0 @@
|
|||||||
const merge = require('webpack-merge')
|
|
||||||
const common = require('./webpack.common.js')
|
|
||||||
|
|
||||||
module.exports = merge(common, {
|
|
||||||
mode: 'production'
|
|
||||||
})
|
|
Loading…
x
Reference in New Issue
Block a user