diff options
author | Ajay Ramachandran <[email protected]> | 2020-01-28 22:16:48 -0500 |
---|---|---|
committer | Ajay Ramachandran <[email protected]> | 2020-01-28 22:16:48 -0500 |
commit | 03836b69f296df8edef412fcb00876dc72fc6eb3 (patch) | |
tree | 6243957ddfb787a34b77a928709757b9d79fb32d /webpack | |
parent | 5837205a9a47e364dc9038221f29b25e091a2ee3 (diff) | |
download | SponsorBlock-03836b69f296df8edef412fcb00876dc72fc6eb3.tar.gz SponsorBlock-03836b69f296df8edef412fcb00876dc72fc6eb3.zip |
Started conversion to TypeScript.
Diffstat (limited to 'webpack')
-rw-r--r-- | webpack/webpack.common.js | 43 | ||||
-rw-r--r-- | webpack/webpack.dev.js | 7 | ||||
-rw-r--r-- | webpack/webpack.prod.js | 6 |
3 files changed, 56 insertions, 0 deletions
diff --git a/webpack/webpack.common.js b/webpack/webpack.common.js new file mode 100644 index 00000000..b70636ad --- /dev/null +++ b/webpack/webpack.common.js @@ -0,0 +1,43 @@ +const webpack = require("webpack"); +const path = require('path'); +const CopyPlugin = require('copy-webpack-plugin'); +const srcDir = '../src/'; + +module.exports = { + entry: { + popup: path.join(__dirname, srcDir + 'popup.ts'), + background: path.join(__dirname, srcDir + 'background.ts'), + content_script: path.join(__dirname, srcDir + 'content_script.ts') + }, + output: { + path: path.join(__dirname, '../dist/js'), + filename: '[name].js' + }, + optimization: { + splitChunks: { + name: 'vendor', + chunks: "initial" + } + }, + module: { + rules: [ + { + test: /\.tsx?$/, + use: 'ts-loader', + exclude: /node_modules/ + } + ] + }, + resolve: { + extensions: ['.ts', '.tsx', '.js'] + }, + plugins: [ + // exclude locale files in moment + new webpack.IgnorePlugin(/^\.\/locale$/, /moment$/), + new CopyPlugin([ + { from: '.', to: '../' } + ], + {context: 'public' } + ), + ] +}; diff --git a/webpack/webpack.dev.js b/webpack/webpack.dev.js new file mode 100644 index 00000000..274eb28d --- /dev/null +++ b/webpack/webpack.dev.js @@ -0,0 +1,7 @@ +const merge = require('webpack-merge'); +const common = require('./webpack.common.js'); + +module.exports = merge(common, { + devtool: 'inline-source-map', + mode: 'development' +});
\ No newline at end of file diff --git a/webpack/webpack.prod.js b/webpack/webpack.prod.js new file mode 100644 index 00000000..daa65f51 --- /dev/null +++ b/webpack/webpack.prod.js @@ -0,0 +1,6 @@ +const merge = require('webpack-merge'); +const common = require('./webpack.common.js'); + +module.exports = merge(common, { + mode: 'production' +});
\ No newline at end of file |