diff --git a/.gitignore b/.gitignore index 30d15a5..4f772ee 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,5 @@ npm-debug.log node_modules/ +dev/ dist/ tmp/ \ No newline at end of file diff --git a/webpack/webpack.common.js b/webpack/webpack.common.js index a3a216c..4e09b6c 100644 --- a/webpack/webpack.common.js +++ b/webpack/webpack.common.js @@ -1,4 +1,3 @@ -const webpack = require('webpack') const path = require('path') const CopyPlugin = require('copy-webpack-plugin') const SRC_DIR = path.join(__dirname, '..', 'src') @@ -8,36 +7,35 @@ module.exports = { popup: path.join(SRC_DIR, 'popup.tsx'), options: path.join(SRC_DIR, 'options.tsx'), background: path.join(SRC_DIR, 'background.ts'), - content_script: path.join(SRC_DIR, 'content_script.tsx') + content_script: path.join(SRC_DIR, 'content_script.tsx'), }, output: { - path: path.join(__dirname, '../dist/js'), - filename: '[name].js' + filename: '[name].js', }, optimization: { splitChunks: { name: 'vendor', - chunks (chunk) { + chunks(chunk) { return chunk.name !== 'background' - } - } + }, + }, }, module: { rules: [ { test: /\.tsx?$/, use: 'ts-loader', - exclude: /node_modules/ - } - ] + exclude: /node_modules/, + }, + ], }, resolve: { - extensions: ['.ts', '.tsx', '.js'] + extensions: ['.ts', '.tsx', '.js'], }, plugins: [ new CopyPlugin({ patterns: [{ from: '.', to: '../', context: 'public' }], - options: {} - }) - ] + options: {}, + }), + ], } diff --git a/webpack/webpack.dev.js b/webpack/webpack.dev.js index 1bf3b60..149af24 100644 --- a/webpack/webpack.dev.js +++ b/webpack/webpack.dev.js @@ -1,7 +1,11 @@ const { merge } = require('webpack-merge') const common = require('./webpack.common.js') +const path = require('path') module.exports = merge(common, { + mode: 'development', devtool: 'inline-source-map', - mode: 'development' + output: { + path: path.join(__dirname, '../dev/js'), + }, }) diff --git a/webpack/webpack.prod.js b/webpack/webpack.prod.js index 53f8aae..52b521c 100644 --- a/webpack/webpack.prod.js +++ b/webpack/webpack.prod.js @@ -1,6 +1,10 @@ const { merge } = require('webpack-merge') const common = require('./webpack.common.js') +const path = require('path') module.exports = merge(common, { - mode: 'production' + mode: 'production', + output: { + path: path.join(__dirname, '../dist/js'), + }, })