Last active
September 14, 2021 11:49
-
-
Save evanw/a8d65017c7876e85861245af7821d038 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Show hidden characters
{ | |
"presets": [ | |
["env", { | |
"targets": { | |
"browsers": ["chrome 85"] | |
} | |
}] | |
] | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// node: function | |
// browserify: function | |
// esbuild: object | |
// webpack: object | |
// parcel: object | |
// rollup: object | |
console.log(typeof require('node-fetch')); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
default: node browserify esbuild webpack parcel rollup | |
node: | |
node entry.js | |
browserify: | |
npx browserify entry.js -o out-browserify.js && node out-browserify.js | |
esbuild: | |
npx esbuild --bundle entry.js --platform=node | node | |
webpack: | |
npx webpack entry.js -o out-webpack.js --silent && node out-webpack.js | |
parcel: | |
npx parcel build entry.js --out-dir . -o out-parcel.js --no-autoinstall > /dev/null && node out-parcel.js | |
rollup: | |
npx rollup -c rollup.config.js entry.js -o out-rollup.js --silent && node out-rollup.js |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"dependencies": { | |
"@rollup/plugin-commonjs": "15.0.0", | |
"@rollup/plugin-node-resolve": "9.0.0", | |
"browserify": "16.5.2", | |
"esbuild": "0.6.30", | |
"node-fetch": "3.0.0-beta.8", | |
"parcel": "1.12.4", | |
"rollup": "2.26.10", | |
"webpack": "4.44.1", | |
"webpack-cli": "3.3.12" | |
}, | |
"devDependencies": { | |
"babel-core": "6.26.3", | |
"babel-preset-env": "1.7.0" | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import commonjs from '@rollup/plugin-commonjs'; | |
import { nodeResolve } from '@rollup/plugin-node-resolve'; | |
export default { | |
output: { | |
exports: 'auto', | |
format: 'cjs', | |
}, | |
plugins: [nodeResolve({ | |
preferBuiltins: true, | |
}), commonjs()], | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment