Skip to content

Add define option - #312

Merged
developit merged 9 commits into
masterfrom
define-option
Feb 20, 2019
Merged

developit merged 9 commits into
masterfrom
define-option

Conversation

@developit

@developit developit commented Jan 30, 2019 •

Copy link
Copy Markdown
Owner

Same as Terser's --define:

microbundle --define NODE_ENV=production
# this is also now set as the default ^

@marvinhagemeister marvinhagemeister left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Awesome, that's a really useful feature 👍

Comment thread src/index.js Outdated
globals = Object.assign(globals, parseMappingArgument(options.globals));
}

const NODE_ENV = process.env.NODE_ENV || 'production';

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

this is for libraries

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

so I don't support having that as the default at this point in the "toolchain"

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

That is a good point. NODE_ENV and process.env.NODE_ENV are probably best left undefined altogether by default.

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

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

@ForsakenHarmony think it's better to not do inlining by default? I'm good with that.

@developit

developit commented Feb 13, 2019 •

Copy link
Copy Markdown
Owner Author

Also apparently I'd managed to miss #233 when I opened this. I'm not sure which is better, though my guess is it's faster/cheaper to use Terser's global_defs option than rollup-plugin-define which I believe uses magic-string.

@weslleyaraujo

Copy link
Copy Markdown

Is there any plans for a release including this soon? 😄
that would be super helpful on the project I am working on 👍

@guicamillo

Copy link
Copy Markdown

Is there any plans for a release including this soon? 😄
that would be super helpful on the project I am working on 👍

Same thing over here :D

@developit

Copy link
Copy Markdown
Owner Author

yup

@developit
developit merged commit f58e677 into master Feb 20, 2019
@bors
bors Bot deleted the define-option branch February 20, 2019 16:13
@andria-dev

Copy link
Copy Markdown

Since --define was released in version 0.10.1 it should probably be added to the README, seems like the only place it's documented currently is the releases tab.

@andria-dev andria-dev mentioned this pull request Mar 17, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants