diff options
author | Determinant <tederminant@gmail.com> | 2019-04-08 22:03:39 +0000 |
---|---|---|
committer | Determinant <tederminant@gmail.com> | 2019-04-08 22:03:39 +0000 |
commit | ad1da0e52f75ac94929f6a99195a69f839107933 (patch) | |
tree | 4d2204ea8c8a9e54058a346662eb354bf4400e13 /webpack.config.js |
init
Diffstat (limited to 'webpack.config.js')
-rw-r--r-- | webpack.config.js | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/webpack.config.js b/webpack.config.js new file mode 100644 index 0000000..4313145 --- /dev/null +++ b/webpack.config.js @@ -0,0 +1,46 @@ +const path = require("path"); +const HtmlWebpackPlugin = require("html-webpack-plugin"); +const CopyWebpackPlugin = require('copy-webpack-plugin'); +module.exports = (env, argv) => { + const prodMode = argv.mode == 'production'; + return { + entry: { + index: "./src/index.tsx", + }, + output: { + path: path.join(__dirname, "/dist"), + filename: "[name].js" + }, + resolve: { + extensions: [".ts", ".tsx", ".js", ".json"] + }, + devtool: "source-map", + module: { + rules: [ + { + test: /\.tsx?$/, + exclude: /node_modules/, + use: ['ts-loader'] + }, + { + test: /\.js$/, + exclude: /node_modules/, + use: ["source-map-loader"], + enforce: "pre" + }, + { + test: /\.css$/, + use: ["style-loader", "css-loader"] + }, + { test: /\.(png|woff|woff2|eot|ttf|svg)$/, loader: 'url-loader?limit=100000' } + ] + }, + plugins: [ + new HtmlWebpackPlugin({ + chunks: ['index'], + template: "./src/index.html", + filename: "./index.html" + }), + ], + }; +}; |