Skip to content

Commit

Permalink
Use .mjs extn for module entry & strip comments (#1166)
Browse files Browse the repository at this point in the history
Change dist module extension to .mjs and strip comments.
  • Loading branch information
lukeed authored Jul 10, 2018
2 parents 9febcaf + 5ed8e08 commit b8a117a
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 5 deletions.
1 change: 1 addition & 0 deletions config/rollup.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ export default {
sourceMap: true,
exclude: 'node_modules/**',
babelrc: false,
comments: false,
presets: [
['env', {
modules: false,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
8 changes: 4 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -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",
Expand Down

0 comments on commit b8a117a

Please sign in to comment.