Skip to content

Commit

Permalink
test
Browse files Browse the repository at this point in the history
  • Loading branch information
renjianfeng committed Apr 11, 2022
0 parents commit 5fbb1d7
Show file tree
Hide file tree
Showing 2 changed files with 61 additions and 0 deletions.
Binary file added .DS_Store
Binary file not shown.
61 changes: 61 additions & 0 deletions webpack.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
const path = require('path');
// Optimizes duplicates in splitted bundles
// const webpack = require('webpack');
// creates index.html file by a template index.ejs
const HtmlWebpackPlugin = require('html-webpack-plugin');
// cleans dist folder
const { CleanWebpackPlugin } = require('clean-webpack-plugin');
// copies the assets folder into dist folder
const CopyWebpackPlugin = require('copy-webpack-plugin');
// output folder location
const distFolder = "./dist";

module.exports = {
// context: __dirname,

mode: 'development',
entry: './src/index.ts',

plugins: [
new CleanWebpackPlugin(),
new HtmlWebpackPlugin({
template: 'src/index.ejs',
}),
new CopyWebpackPlugin({
patterns: [
{ from: 'src/assets', to: 'assets' },
]
})
],
devtool: 'inline-source-map',
devServer: {
contentBase: distFolder
},
module: {
rules: [
{
test: /\.tsx?$/,
use: 'ts-loader',
exclude: /node_modules/
}
]
},
optimization: {
splitChunks: {
cacheGroups: {
commons: {
test: /[\\/]node_modules[\\/]/,
name: "vendors",
// chunks: "all"
}
}
}
},
resolve: {
extensions: [".tsx", ".ts", ".js"]
},
output: {
filename: '[name].bundle.js',
path: path.resolve(__dirname, distFolder)
}
};

0 comments on commit 5fbb1d7

Please sign in to comment.