tridactyl/webpack.config.js
Colin Caine 5964430fe1 Convert to es6 modules
Motivation:

 - Most test frameworks expect modules
 - I'm told they're the future

Changes:

 - Every typescript source file is now an es6 module
 - Build system is now webpack (tho rollup makes nicer outputs)
 - Outputs of buildsystem are one js file per entry point (background,
   content, commandline_frame)
 - These bundled js files are generated by traversing the dependency
   graph of each entry point
2017-10-02 01:17:32 +01:00

44 lines
1.3 KiB
JavaScript

const UglifyJSPlugin = require('uglifyjs-webpack-plugin')
const CopyWebPackPlugin = require('copy-webpack-plugin')
module.exports = {
entry: {
background: "./src/background.ts",
content: "./src/content.ts",
commandline_frame: "./src/commandline_frame.ts",
},
output: {
filename: "[name].js",
path: __dirname + "/build"
},
// Enable sourcemaps for debugging webpack's output.
devtool: "source-map",
resolve: {
// Add '.ts' and '.tsx' as resolvable extensions.
extensions: [".ts", ".tsx", ".js", ".json"]
},
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'.
{ enforce: "pre", test: /\.js$/, loader: "source-map-loader" }
]
},
plugins: [
// new UglifyJSPlugin({
// uglifyOptions: {
// ecma: 8
// }
// }),
new CopyWebPackPlugin([
{ from: "src/manifest.json" },
{ from: "src/static", to: "static" },
]),
]
}