const path = require('path');
const HtmlWebPackPlugin = require('html-webpack-plugin');
module.exports = {
entry: {
app: ['./src/main.tsx'],
// vendor: ['react', 'react-dom', 'semantic-ui-css', 'semantic-ui-react']
},
output: {
path: path.resolve(__dirname, 'dist'),
filename: '[name].[hash].bundle.js'
},
devtool: "source-map",
resolve: {
alias: {
'semantic-ui': path.join(__dirname, "node_modules", "semantic-ui-css", "semantic-ui-react"),
},
extensions: [".ts", ".tsx", ".js", ".jsx", ".json"]
},
optimization: {
splitChunks: {
maxSize: 0,
chunks: "all"
}
},
module: {
rules: [
{
test: /\.(ts|tsx)$/,
exclude: /node_modules/,
loader: ["awesome-typescript-loader"]
},
{
test: /\.css$/,
exclude: /node_modules/,
use: [
'style-loader', {
loader: 'css-loader',
options: {
modules: true
},
},
],
},
{
test: /\.css$/,
include: /node_modules/,
use: ['style-loader', 'css-loader']
},
{
test: /\.(png|jpg|gif|svg)$/i,
use: [
{
loader: 'url-loader',
options: {
name: 'images/[name].[ext]',
limit: false
},
},
],
},
{
test: [/\.eot$/, /\.ttf$/, /\.svg$/, /\.woff$/, /\.woff2$/],
loader: require.resolve("file-loader"),
options: {
name: "/media/[name].[hash:8].[ext]",
},
}
]
},
plugins: [
new HtmlWebPackPlugin({
template: "./src/index.html",
filename: "./index.html"
})
]
};