rollup/rollup-plugin-node-resolve

rollup 0.61.0 with rollup-plugin-node-resolve 3.3.0 leads to messed up undefined values

qubyte opened this issue · 3 comments

Reduction:

// hello.js (content unimportant)
const hi = 'hello';
export default hi;
// index.js
import hi from './hello.js'; // without this nothing bad happens
var a;
console.log(a === undefined);

Compile these with from the same directory:

require('rollup').rollup({ input: './index.js', plugins: [require('rollup-plugin-node-resolve')()] })
  .then(b => b.generate({ format: 'cjs' }))
  .then(c => console.log(c.code));

And it logs:

'use strict';

var a;
console.log(a === undefined$1);

The oddness here is undefined$1. Commenting out the import seems to fix the issue.

Probably related to rollup/rollup#2290 (if so, this plugin is probably not the issue, my apologies)

Yes, it is definitely rollup/rollup#2290. Sorry for this.

No problem, 💩 happens!