Skip to content
This repository has been archived by the owner on Aug 4, 2021. It is now read-only.

fix(): make empty.js virtual #224

Merged
merged 2 commits into from Jun 16, 2019

Conversation

manucorporat
Copy link
Contributor

At stencil we try to make rollup and this plugin to work in the browser, in addition, we bundle rollup-plugin-node-resolve into the stencil's bundle. The fact that empty.js is a read file within the file system makes it harder in some cases.

This PR solves that by making the empty.js file a virtual module.

@manucorporat
Copy link
Contributor Author

In addition, it modernizes the code a little bit, but using Map() and avoiding excessive branches.

src/index.js Outdated

const ES6_BROWSER_EMPTY = resolve( __dirname, '../src/empty.js' );
const ES6_BROWSER_EMPTY = '!node-resolve:empty.js';
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As this is kind of a private module, I would assume it should be prefixed with \0 instead to avoid other plugins from messing with it, e.g. by inserting code?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@lukastaegert fixed!

@lukastaegert
Copy link
Member

Really like the changes!

Copy link
Member

@lukastaegert lukastaegert left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@lukastaegert lukastaegert merged commit 1719511 into rollup:master Jun 16, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants