tridactyl/webpack.config.js
Jakub Okoński d22d1c9d52 Replace awesome-typescript-loader with ts-loader
awesome-typescript-loader seems to be unsupported, it hasn't been
updated in a year. Performance and features of ts-loader look to be
on par with the previous solution.
2019-10-20 12:49:06 +02:00

68 lines
2.1 KiB
JavaScript

const TsconfigPathsPlugin = require("tsconfig-paths-webpack-plugin")
const CopyWebPackPlugin = require("copy-webpack-plugin")
// const WebpackShellPlugin = require('webpack-shell-plugin')
const fileExtensions = [".ts", ".tsx", ".js", ".json"]
module.exports = {
mode: "development",
entry: {
background: "./src/background.ts",
content: "./src/content.ts",
commandline_frame: "./src/commandline_frame.ts",
help: "./src/help.ts",
newtab: "./src/newtab.ts",
},
output: {
filename: "[name].js",
path: __dirname + "/build",
},
// Enable sourcemaps for debugging webpack's output.
devtool: "inline-source-map",
resolve: {
// Add '.ts' and '.tsx' as resolvable extensions.
extensions: fileExtensions,
plugins: [new TsconfigPathsPlugin({extensions: fileExtensions})]
},
module: {
rules: [
// All files with a '.ts' or '.tsx' extension will be handled by 'ts-loader'.
{ test: /\.tsx?$/, loader: "ts-loader" },
// All output '.js' files will have any sourcemaps re-processed by 'source-map-loader'.
{ enforce: "pre", test: /\.js$/, loader: "source-map-loader" },
],
},
plugins: [
// new UglifyJSPlugin({
// uglifyOptions: {
// ecma: 8
// }
// }),
// new WebpackShellPlugin({onBuildStart: [
// 'mkdir -p generated/static',
// 'scripts/excmds_macros.py',
// 'scripts/newtab.md.sh',
// 'scripts/make_docs.sh',
// ]}),
new CopyWebPackPlugin([
{ from: "src/manifest.json" },
{
from: "src/static",
to: "static",
ignore: ["*.psd", "*1024px.png"],
},
{ from: "generated/static", to: "static" },
{ from: "issue_template.md" },
]),
],
// Fix css
// https://github.com/webpack-contrib/css-loader/issues/447#issuecomment-285598881
node: {
fs: "empty",
},
}