1
0
Fork 0

wrench: Updated rollup configuration

This updates the rollup config to avoid having the spread operator
in the generated code as that causes issues when people want to
bundle our code with webpack (which doesn't support the spread
operator for object literals).

This also changes the browserbuild script to avoid issues for people
running this on Windows. Hat-tip to @philltew for this one.

Note that this is the first plugin where I'm updating the rollup
config. I'll have to do the same for all plugins and patterns,
but it's unlikely I'll write this long a commit message for each
one of them :)
This commit is contained in:
Joost De Cock 2019-04-13 14:36:11 +02:00
parent 9e12c25af4
commit 7695d738c2
3 changed files with 15 additions and 8 deletions

View file

@ -348,9 +348,9 @@
}
},
"@babel/plugin-proposal-object-rest-spread": {
"version": "7.2.0",
"resolved": "https://registry.npmjs.org/@babel/plugin-proposal-object-rest-spread/-/plugin-proposal-object-rest-spread-7.2.0.tgz",
"integrity": "sha512-1L5mWLSvR76XYUQJXkd/EEQgjq8HHRP6lQuZTTg0VA4tTGPpGemmCdAfQIz1rzEuWAm+ecP8PyyEm30jC1eQCg==",
"version": "7.4.3",
"resolved": "https://registry.npmjs.org/@babel/plugin-proposal-object-rest-spread/-/plugin-proposal-object-rest-spread-7.4.3.tgz",
"integrity": "sha512-xC//6DNSSHVjq8O2ge0dyYlhshsH4T7XdCVoxbi5HzLYWfsC5ooFlJjrXk8RcAT+hjHAK9UjBXdylzSoDK3t4g==",
"dev": true,
"requires": {
"@babel/helper-plugin-utils": "^7.0.0",
@ -4427,6 +4427,7 @@
"version": "0.1.4",
"bundled": true,
"dev": true,
"optional": true,
"requires": {
"kind-of": "^3.0.2",
"longest": "^1.0.1",
@ -5369,7 +5370,8 @@
"longest": {
"version": "1.0.1",
"bundled": true,
"dev": true
"dev": true,
"optional": true
},
"lru-cache": {
"version": "4.1.3",

View file

@ -30,9 +30,9 @@
"clean": "rimraf dist",
"pretty": "npx prettier --write 'src/*.js'",
"lint": "eslint --fix 'src/*.js'",
"browserbuild": "rollup -c rollup.js --file dist/browser.js --format iife -m true --name freesewing.plugins.title",
"nodebuild": "rollup -c rollup.js --file dist/index.js --format cjs -m true",
"modulebuild": "rollup -c rollup.js --file dist/index.mjs --format es -m true",
"nodebuild": "rollup -c -o dist/index.js -f cjs",
"modulebuild": "rollup -c -o dist/index.mjs -f es",
"browserbuild": "rollup -c -o dist/browser.js -f iife -n freesewing_plugins_title --footer \"freesewing.plugins.title = freesewing_plugins_title;\"",
"rebuild": "npm run nodebuild && npm run modulebuild",
"build": "npm run clean && npm run browserbuild && npm run nodebuild && npm run modulebuild"
},
@ -49,6 +49,7 @@
},
"devDependencies": {
"@babel/core": "^7.1.0",
"@babel/plugin-proposal-object-rest-spread": "7.4.3",
"@babel/preset-env": "^7.1.0",
"@babel/register": "^7.0.0",
"chai": "^4.1.2",

View file

@ -6,13 +6,17 @@ import { version, name, description, author, license } from "./package.json";
export default {
input: "src/index.js",
output: {
sourcemap: true
},
plugins: [
resolve({
browser: true
}),
json(),
babel({
exclude: "node_modules/**"
exclude: "node_modules/**",
plugins: ["@babel/plugin-proposal-object-rest-spread"]
}),
terser({
output: {