Created
August 31, 2019 17:41
-
-
Save kiishi/d6bf2c1b75c81bac14b75d007e9de744 to your computer and use it in GitHub Desktop.
personal webpack config TS
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # install these | |
| -style-loader | |
| -sass-loader | |
| -css-loader | |
| -wepack | |
| -webpack-cli | |
| -terser-webapack-plugin | |
| #now the code (for react ) | |
| const path = require("path"); | |
| const terser = require('terser-webpack-plugin') | |
| module.exports = { | |
| entry: "./index.tsx", | |
| module: { | |
| rules: [ | |
| { | |
| test: /\.tsx?$/, | |
| use: "ts-loader", | |
| exclude: /node_modules/ | |
| }, | |
| { | |
| test: /\.css$/, | |
| use: [ | |
| { loader: "style-loader" }, | |
| { | |
| loader: "css-loader", | |
| options: { | |
| modules: true | |
| } | |
| } | |
| ] | |
| }, | |
| { | |
| test: /\.scss$/, | |
| use: ["style-loader" , "css-loader","sass-loader"], | |
| exclude: /node_modules/ | |
| } | |
| ] | |
| }, | |
| plugins:[ | |
| new terser() | |
| ], | |
| devServer: { | |
| contentBase: "dist/", | |
| watchContentBase: true, | |
| hot: true | |
| }, | |
| resolve: { | |
| extensions: [".tsx", ".ts", ".js"] | |
| }, | |
| output: { | |
| filename: "bundle.js", | |
| path: path.resolve(__dirname, "dist") | |
| } | |
| }; | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment