2018-10-04 13:59:19 +01:00
|
|
|
const { TsConfigPathsPlugin } = require("awesome-typescript-loader")
|
2018-04-21 23:43:12 +01:00
|
|
|
const CopyWebPackPlugin = require("copy-webpack-plugin")
|
2017-11-12 01:42:55 +00:00
|
|
|
// const WebpackShellPlugin = require('webpack-shell-plugin')
|
2017-10-02 00:59:51 +01:00
|
|
|
|
|
|
|
module.exports = {
|
2018-09-14 22:13:13 +02:00
|
|
|
mode: "development",
|
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
|
|
|
},
|
|
|
|
|
|
|
|
// Enable sourcemaps for debugging webpack's output.
|
2017-11-09 00:40:30 +00:00
|
|
|
devtool: "inline-source-map",
|
2017-10-02 00:59:51 +01:00
|
|
|
|
|
|
|
resolve: {
|
|
|
|
// Add '.ts' and '.tsx' as resolvable extensions.
|
2018-04-21 23:43:12 +01:00
|
|
|
extensions: [".ts", ".tsx", ".js", ".json"],
|
2018-10-04 13:59:19 +01:00
|
|
|
plugins: [new TsConfigPathsPlugin()],
|
2017-10-02 00:59:51 +01:00
|
|
|
},
|
|
|
|
|
|
|
|
module: {
|
|
|
|
rules: [
|
|
|
|
// All files with a '.ts' or '.tsx' extension will be handled by 'awesome-typescript-loader'.
|
|
|
|
{ test: /\.tsx?$/, loader: "awesome-typescript-loader" },
|
|
|
|
|
|
|
|
// 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: [
|
|
|
|
// new UglifyJSPlugin({
|
|
|
|
// uglifyOptions: {
|
|
|
|
// ecma: 8
|
|
|
|
// }
|
|
|
|
// }),
|
2017-11-12 01:42:55 +00:00
|
|
|
// new WebpackShellPlugin({onBuildStart: [
|
|
|
|
// 'mkdir -p generated/static',
|
|
|
|
// 'scripts/excmds_macros.py',
|
|
|
|
// 'scripts/newtab.md.sh',
|
|
|
|
// 'scripts/make_docs.sh',
|
|
|
|
// ]}),
|
2017-10-02 00:59:51 +01:00
|
|
|
new CopyWebPackPlugin([
|
|
|
|
{ from: "src/manifest.json" },
|
2018-04-21 23:43:12 +01:00
|
|
|
{
|
|
|
|
from: "src/static",
|
|
|
|
to: "static",
|
|
|
|
ignore: ["*.psd", "*1024px.png"],
|
|
|
|
},
|
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" },
|
2017-10-02 00:59:51 +01:00
|
|
|
]),
|
2018-04-21 23:43:12 +01:00
|
|
|
],
|
|
|
|
// Fix css
|
|
|
|
// https://github.com/webpack-contrib/css-loader/issues/447#issuecomment-285598881
|
|
|
|
node: {
|
|
|
|
fs: "empty",
|
|
|
|
},
|
2017-10-02 00:59:51 +01:00
|
|
|
}
|