Started conversion to TypeScript.

This commit is contained in:
Ajay Ramachandran
2020-01-28 22:16:48 -05:00
parent 5837205a9a
commit 03836b69f2
52 changed files with 5729 additions and 418 deletions

43
webpack/webpack.common.js Normal file
View File

@@ -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' }
),
]
};

7
webpack/webpack.dev.js Normal file
View File

@@ -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'
});

6
webpack/webpack.prod.js Normal file
View File

@@ -0,0 +1,6 @@
const merge = require('webpack-merge');
const common = require('./webpack.common.js');
module.exports = merge(common, {
mode: 'production'
});