Add webpack support
This commit is contained in:
parent
fb3ef7475c
commit
eb2075aec5
33 changed files with 988 additions and 765 deletions
48
webpack.config.js
Normal file
48
webpack.config.js
Normal file
|
|
@ -0,0 +1,48 @@
|
|||
const path = require("path");
|
||||
const HtmlWebpackPlugin = require("html-webpack-plugin");
|
||||
const { CleanWebpackPlugin } = require("clean-webpack-plugin");
|
||||
|
||||
module.exports = {
|
||||
mode: "development",
|
||||
devtool: "inline-source-map",
|
||||
plugins: [
|
||||
new CleanWebpackPlugin(),
|
||||
new HtmlWebpackPlugin({
|
||||
hash: true,
|
||||
xhtml: true,
|
||||
template: "./src/index.html"
|
||||
})
|
||||
],
|
||||
entry: {
|
||||
index: "./src/ts/index.ts"
|
||||
},
|
||||
module: {
|
||||
rules: [
|
||||
{
|
||||
test: /\.s[ac]ss$/i,
|
||||
use: ["style-loader", "css-loader", "sass-loader"]
|
||||
},
|
||||
{
|
||||
test: /\.tsx?$/,
|
||||
use: "ts-loader",
|
||||
exclude: /node_modules/
|
||||
},
|
||||
{
|
||||
test: /\.(png|svg|jpe?g|gif)$/,
|
||||
use: {
|
||||
loader: "file-loader",
|
||||
query: {
|
||||
outputPath: "images"
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
resolve: {
|
||||
extensions: [".ts"]
|
||||
},
|
||||
output: {
|
||||
filename: "[name].bundle.js",
|
||||
path: path.resolve(__dirname, "dist")
|
||||
}
|
||||
};
|
||||
Loading…
Add table
Add a link
Reference in a new issue