initialized webpack and babel

This commit is contained in:
Fran Jurmanović
2021-05-28 18:37:31 +02:00
commit 888c76829c
8 changed files with 4677 additions and 0 deletions

55
webpack.config.js Normal file
View File

@@ -0,0 +1,55 @@
const path = require('path');
const HtmlWebpackPlugin = require('html-webpack-plugin');
module.exports = {
entry: {
app: ['babel-polyfill', './src/index']
},
optimization: {
runtimeChunk: 'single',
splitChunks: {
chunks: 'all',
cacheGroups: {
commons: {
test: /[\\/]node_modules[\\/]/,
name: "vendor",
chunks: "initial",
minSize: 200000,
maxSize: 400000
},
styles: {
name: 'styles',
test: /\.css$/,
chunks: 'all'
}
}
}
},
output: {
path: path.join(__dirname, 'public'),
filename: '[name].[contenthash].js',
publicPath: '/'
},
module: {
rules: [
{
test: /\.(js|ts)?$/,
exclude: /node_modules/,
use: {
loader: 'babel-loader'
}
},
]
},
plugins: [
new HtmlWebpackPlugin({
template: './src/index.html'
}),
],
resolve: {
extensions: ['.js', '.ts']
},
devServer: {
historyApiFallback: true,
}
}