From 5ed8e08d23ece2c30061538acbd2e59d6e282785 Mon Sep 17 00:00:00 2001 From: Jason Miller Date: Tue, 10 Jul 2018 11:33:14 -0400 Subject: [PATCH] Change dist module extension to .mjs and strip comments. Fixes #1165 --- config/rollup.config.js | 1 + config/{rollup.config.esm.js => rollup.config.module.js} | 2 +- package.json | 8 ++++---- 3 files changed, 6 insertions(+), 5 deletions(-) rename config/{rollup.config.esm.js => rollup.config.module.js} (78%) diff --git a/config/rollup.config.js b/config/rollup.config.js index 91f06b7022..a30eb882be 100644 --- a/config/rollup.config.js +++ b/config/rollup.config.js @@ -27,6 +27,7 @@ export default { sourceMap: true, exclude: 'node_modules/**', babelrc: false, + comments: false, presets: [ ['env', { modules: false, diff --git a/config/rollup.config.esm.js b/config/rollup.config.module.js similarity index 78% rename from config/rollup.config.esm.js rename to config/rollup.config.module.js index d646683f40..ff215324ca 100644 --- a/config/rollup.config.esm.js +++ b/config/rollup.config.module.js @@ -2,7 +2,7 @@ import config from './rollup.config'; // ES output config.output.format = 'es'; -config.output.file = 'dist/preact.esm.js'; +config.output.file = 'dist/preact.mjs'; // remove memory() plugin config.plugins.splice(0, 1); diff --git a/package.json b/package.json index daa6ef3fc8..4a8ca1220c 100644 --- a/package.json +++ b/package.json @@ -3,8 +3,8 @@ "version": "8.2.9", "description": "Fast 3kb React alternative with the same modern API. Components & Virtual DOM.", "main": "dist/preact.js", - "jsnext:main": "dist/preact.esm.js", - "module": "dist/preact.esm.js", + "jsnext:main": "dist/preact.mjs", + "module": "dist/preact.mjs", "dev:main": "dist/preact.dev.js", "minified:main": "dist/preact.min.js", "types": "dist/preact.d.ts", @@ -16,13 +16,13 @@ "flow": "flow", "transpile:main": "rollup -c config/rollup.config.js", "transpile:devtools": "rollup -c config/rollup.config.devtools.js", - "transpile:esm": "rollup -c config/rollup.config.esm.js", + "transpile:esm": "rollup -c config/rollup.config.module.js", "transpile:debug": "babel debug/ -o debug.js -s", "transpile": "npm-run-all transpile:main transpile:esm transpile:devtools transpile:debug", "optimize": "uglifyjs dist/preact.dev.js -c conditionals=false,sequences=false,loops=false,join_vars=false,collapse_vars=false --pure-funcs=Object.defineProperty --mangle-props --mangle-regex=\"/^(_|normalizedNodeName|nextBase|prev[CPS]|_parentC)/\" --name-cache config/properties.json -b width=120,quote_style=3 -o dist/preact.js -p relative --in-source-map dist/preact.dev.js.map --source-map dist/preact.js.map", "minify": "uglifyjs dist/preact.js -c collapse_vars,evaluate,screw_ie8,unsafe,loops=false,keep_fargs=false,pure_getters,unused,dead_code -m -o dist/preact.min.js -p relative --in-source-map dist/preact.js.map --source-map dist/preact.min.js.map", "strip:main": "jscodeshift --run-in-band -s -t config/codemod-strip-tdz.js dist/preact.dev.js && jscodeshift --run-in-band -s -t config/codemod-const.js dist/preact.dev.js && jscodeshift --run-in-band -s -t config/codemod-let-name.js dist/preact.dev.js", - "strip:esm": "jscodeshift --run-in-band -s -t config/codemod-strip-tdz.js dist/preact.esm.js && jscodeshift --run-in-band -s -t config/codemod-const.js dist/preact.esm.js && jscodeshift --run-in-band -s -t config/codemod-let-name.js dist/preact.esm.js", + "strip:esm": "jscodeshift --run-in-band -s -t config/codemod-strip-tdz.js dist/preact.mjs && jscodeshift --run-in-band -s -t config/codemod-const.js dist/preact.mjs && jscodeshift --run-in-band -s -t config/codemod-let-name.js dist/preact.mjs", "strip": "npm-run-all strip:main strip:esm", "size": "node -e \"process.stdout.write('gzip size: ')\" && gzip-size --raw dist/preact.min.js", "test": "npm-run-all lint --parallel test:mocha test:karma test:ts test:flow test:size",