minor on webpack configuration and add build script

This commit is contained in:
lesion 2021-11-19 17:55:12 +01:00
parent 2c944faff3
commit c0b11c7218
2 changed files with 16 additions and 17 deletions

View file

@ -13,7 +13,8 @@
"scripts": { "scripts": {
"test": "npm run test:node && npm run test:browser", "test": "npm run test:node && npm run test:browser",
"test:node": "mocha", "test:node": "mocha",
"test:browser": "karma start --single-run --browsers ChromeHeadless,FirefoxHeadless karma.config.js" "test:browser": "karma start --single-run --browsers ChromeHeadless,FirefoxHeadless karma.config.js",
"build": "webpack"
}, },
"author": "", "author": "",
"license": "ISC", "license": "ISC",

View file

@ -1,17 +1,15 @@
const path = require('path'); const path = require('path')
module.exports = [] module.exports = ['web', 'node'].map(
for(let target of ['web', 'node']) { target => ({
var conf = { name: target,
name: target, mode: 'production',
entry: './radiomanifest.js', entry: './radiomanifest.js',
target: [target], target: [target],
output: { output: {
path: path.resolve(__dirname, 'dist'), path: path.resolve(__dirname, 'dist'),
filename: 'radiomanifest-' + target + '.bundle.js', filename: 'radiomanifest-' + target + '.bundle.js',
clean: false, clean: false
}, }
} })
module.exports.push(conf) )
}
console.log(module.exports)