Closed unional closed 7 years ago
your type-script build turns your imports into requires so this is totally not related to this particular plugin but more generally combining typescript and rollup
It seems like this is more related to rollup-plugin-commonjs
than to rollup-plugin-node-builtins
.
Thanks.
I ran this is transpiled directly by tsc
and the transpilation target is es5
.
Does rollup-plugin-commonjs
and rollup-plugin-node-builtins
support es5
or only es6/es2015
?
I want to bundle the es5
version because my (personal) use cases involve supporting older browsers.
rollup is designed for bundling es6 modules rollup-plugin-commonjs
is for use if you have some commonjs dependencies you need to use as well, if everything is es5 there isn't any point in using rollup, other things work better.
the problem you have is tsc is transpiling the syntax AND the import statements into es5, you want the syntax but not the import statements transpiled and I belive you can use the typescript plugin to do so
I'm using
node-globals
andnode-builtins
to build my bundle.In the code, I use
import { release } from 'os'
:https://github.com/unional/aurelia-logging-color/blob/rollup-require-issue/src/environments.ts
When I bundle and load the script on the browser, it complains:
You can see the error by cloning the repo:
When I use
webpack
, it is working correctly.Here is the
rollup
configuration: https://github.com/unional/aurelia-logging-color/blob/rollup-require-issue/rollup.config.global.jsHere is the
webpack
configuration:https://github.com/unional/aurelia-logging-color/blob/rollup-require-issue/webpack.config.global.js
Thanks. 🌷
UPDATE: pointing to
rollup-require-issue
branch., add repro steps