2019-10-18 16:51:36 +02:00
|
|
|
const TsconfigPathsPlugin = require("tsconfig-paths-webpack-plugin")
|
2018-04-21 23:43:12 +01:00
|
|
|
const CopyWebPackPlugin = require("copy-webpack-plugin")
|
2017-10-02 00:59:51 +01:00
|
|
|
|
2019-10-18 16:51:36 +02:00
|
|
|
const fileExtensions = [".ts", ".tsx", ".js", ".json"]
|
|
|
|
|
2017-10-02 00:59:51 +01:00
|
|
|
module.exports = {
|
2020-05-09 10:45:32 +01:00
|
|
|
|
|
|
|
mode: "development",
|
2020-05-27 10:53:20 +01:00
|
|
|
// mode: "production", // Uncomment me for less helpful error messages
|
2020-05-09 10:45:32 +01:00
|
|
|
|
|
|
|
// Enable sourcemaps for debugging webpack's output.
|
|
|
|
devtool: "source-map",
|
|
|
|
// devtool: "inline-source-map", // Uncomment me for more helpful error messages
|
|
|
|
|
2017-10-02 00:59:51 +01:00
|
|
|
entry: {
|
|
|
|
background: "./src/background.ts",
|
|
|
|
content: "./src/content.ts",
|
|
|
|
commandline_frame: "./src/commandline_frame.ts",
|
2018-06-03 15:04:50 +02:00
|
|
|
help: "./src/help.ts",
|
2018-06-16 15:43:00 +02:00
|
|
|
newtab: "./src/newtab.ts",
|
2017-10-02 00:59:51 +01:00
|
|
|
},
|
|
|
|
output: {
|
|
|
|
filename: "[name].js",
|
2018-04-21 23:43:12 +01:00
|
|
|
path: __dirname + "/build",
|
2017-10-02 00:59:51 +01:00
|
|
|
},
|
|
|
|
|
|
|
|
|
|
|
|
resolve: {
|
|
|
|
// Add '.ts' and '.tsx' as resolvable extensions.
|
2019-10-18 16:51:36 +02:00
|
|
|
extensions: fileExtensions,
|
2021-01-01 16:10:03 +01:00
|
|
|
plugins: [new TsconfigPathsPlugin({extensions: fileExtensions})],
|
|
|
|
fallback: {
|
|
|
|
"url": false,
|
|
|
|
"fs": false,
|
|
|
|
"https": false,
|
|
|
|
"http": false,
|
|
|
|
"path": false,
|
|
|
|
"timers": false,
|
|
|
|
"stream": require.resolve("stream-browserify"),
|
|
|
|
},
|
2017-10-02 00:59:51 +01:00
|
|
|
},
|
|
|
|
|
|
|
|
module: {
|
|
|
|
rules: [
|
2019-10-18 16:51:36 +02:00
|
|
|
// All files with a '.ts' or '.tsx' extension will be handled by 'ts-loader'.
|
|
|
|
{ test: /\.tsx?$/, loader: "ts-loader" },
|
2017-10-02 00:59:51 +01:00
|
|
|
|
|
|
|
// All output '.js' files will have any sourcemaps re-processed by 'source-map-loader'.
|
2018-04-21 23:43:12 +01:00
|
|
|
{ enforce: "pre", test: /\.js$/, loader: "source-map-loader" },
|
|
|
|
],
|
2017-10-02 00:59:51 +01:00
|
|
|
},
|
|
|
|
|
|
|
|
plugins: [
|
2020-05-27 12:01:22 +01:00
|
|
|
new CopyWebPackPlugin({patterns: [
|
2017-10-02 00:59:51 +01:00
|
|
|
{ from: "src/manifest.json" },
|
2018-04-21 23:43:12 +01:00
|
|
|
{
|
|
|
|
from: "src/static",
|
|
|
|
to: "static",
|
2020-05-27 12:01:22 +01:00
|
|
|
globOptions: {
|
2020-08-05 17:12:01 +01:00
|
|
|
ignore: ["**/*.psd", "**/*1024px.png"],
|
2020-05-27 12:01:22 +01:00
|
|
|
},
|
2018-04-21 23:43:12 +01:00
|
|
|
},
|
2017-11-10 13:03:08 +00:00
|
|
|
{ from: "generated/static", to: "static" },
|
2019-04-08 09:07:02 +02:00
|
|
|
{ from: "issue_template.md" },
|
2020-05-27 12:01:22 +01:00
|
|
|
]}),
|
2018-04-21 23:43:12 +01:00
|
|
|
],
|
2017-10-02 00:59:51 +01:00
|
|
|
}
|