Skip to content

Commit

Permalink
Merge pull request #47 from sensasi-delight:sensasi-delight/issue43
Browse files Browse the repository at this point in the history
split dev and dist dir
  • Loading branch information
sensasi-delight authored May 1, 2024
2 parents 34372e6 + 9d14843 commit 0bfd30e
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 16 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
npm-debug.log
node_modules/
dev/
dist/
tmp/
26 changes: 12 additions & 14 deletions webpack/webpack.common.js
Original file line number Diff line number Diff line change
@@ -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')
Expand All @@ -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: {},
}),
],
}
6 changes: 5 additions & 1 deletion webpack/webpack.dev.js
Original file line number Diff line number Diff line change
@@ -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'),
},
})
6 changes: 5 additions & 1 deletion webpack/webpack.prod.js
Original file line number Diff line number Diff line change
@@ -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'),
},
})

0 comments on commit 0bfd30e

Please sign in to comment.