Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add #define #57

Open
MightyPork opened this issue Nov 4, 2021 · 1 comment
Open

Add #define #57

MightyPork opened this issue Nov 4, 2021 · 1 comment

Comments

@MightyPork
Copy link

I'm trying to figure out how to build a "full" and "lite" version from the same codebase with one webpack config file.

If #define was supported, I could have two entry files, app.js and app-lite.js, with the latter starting #define LITE 1. This would then be used with #if etc. to slim down the build.

@nippur72
Copy link
Owner

nippur72 commented Nov 4, 2021

webpack loaders process each file separately and isolatedly, so they can't have knowledge of a #define declared in another file. The only information shared globally is the option object passed to the loader.

Best workaround is to have a single webpack config file that changes according to some command line parameter, but you still have to run it twice.

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

No branches or pull requests

2 participants