Created
November 13, 2020 07:20
-
-
Save Robbie-Cook/30cc6359e72c899d73debe717e905e30 to your computer and use it in GitHub Desktop.
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
| const path = require("path"); | |
| module.exports = { | |
| entry: path.resolve(__dirname, "./src/index.ts"), | |
| output: { | |
| path: path.resolve(__dirname, "./umd"), | |
| filename: "index.js", | |
| libraryTarget: "umd", | |
| library: "MyPackageName", | |
| }, | |
| mode: "production", | |
| target: "web", | |
| // Enable sourcemaps for debugging webpack's output. | |
| devtool: "source-map", | |
| resolve: { | |
| // Add '.ts' and '.tsx' as resolvable extensions. | |
| extensions: [".ts", ".tsx", ".js", ".jsx"], | |
| }, | |
| module: { | |
| rules: [ | |
| { | |
| test: /(\.ts(x?))|(\.jsx?)$/, | |
| exclude: /node_modules/, | |
| use: [ | |
| { | |
| loader: "ts-loader", | |
| options: { | |
| configFile: path.resolve(__dirname, "tsconfig.json"), | |
| }, | |
| }, | |
| ], | |
| }, | |
| // All output '.js' files will have any sourcemaps re-processed by 'source-map-loader'. | |
| { | |
| enforce: "pre", | |
| test: /\.js$/, | |
| exclude: /node_modules/, | |
| loader: "source-map-loader", | |
| }, | |
| { | |
| test: /\.scss$/, | |
| exclude: /node_modules/, | |
| use: [ | |
| // Use the chain sass-loader -> css-loader -> style-loader | |
| // But use MiniCssExtractPlugin on prod, so we get a file. | |
| { | |
| loader: "style-loader", | |
| }, | |
| { | |
| loader: "css-loader", | |
| }, | |
| { | |
| loader: "sass-loader", | |
| }, | |
| ], | |
| }, | |
| ], | |
| }, | |
| plugins: [], | |
| }; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment