Comments (4)
so do you want to write
/// #if my-custom-define
and have it turned into
/// #if my_custom_define
?
I don't think that is possible because what comes after the #if
is meant to be generic JavaScript expression.
Can you please explain your use case? Why not just use my_custom_define
from the beginning?
from ifdef-loader.
From this example in the docs:
const opts = {
DEBUG: true,
version: 3,
"ifdef-verbose": true, // add this for verbose output
"ifdef-triple-slash": false // add this to use double slash comment instead of default triple slash
};
I think it's natural for people to define MY_UPPERCASE_DEFINE
or my-lowercase-define
, but my-lowercase-define
doesn't currently work.
Perhaps incoming options should have dashes turned into underscores, automatically, so:
const opts = {
DEBUG: true,
version: 3,
"ifdef-verbose": true, // add this for verbose output
"ifdef-triple-slash": false // add this to use double slash comment instead of default triple slash
};
Would work with
/// #if ifdef_verbose
and
/// #if ifdef_triple_slash
The truth is that we are porting a library to JavaScript, which supports -Dlowercase-dashed-defines
in the original language. Similar to the format of the ifdef-loader
specific defines above, it would be nice to be able to preserve this for consistency of documentation... and don't dashes feel nice?
from ifdef-loader.
I agree that the docs are not very clear. ifdef-verbose
and ifdef-triple-slash
are not actual symbols available for #if
, they are special switches used to configure the tool itself. And that's why they have -
in their names: name clashing with user defined symbols isn't possible because they ain't valid JavaScript identifiers.
from ifdef-loader.
Oh yeah, I understand 😄
I just mean, ifdef-verbose
feels nice. ifdef_verbose
feels a little funny. I don't think these defines (themselves) are necessary in other source files, but a quick sanitize on the define names might be nice and make this pattern valid for user defines, too
from ifdef-loader.
Related Issues (20)
- babel-loader complains about syntax errors in code that should be removed HOT 1
- Improve documentation to include onlyCompileBundledFiles option
- Webpack & Angular 7 HOT 7
- [Feature Request] treat undefined keys as false HOT 2
- Regular expression not working well in some cases HOT 6
- Define environment variables by default HOT 1
- Deprecation warning when used with webpack 5.0.0
- /////// leftovers in HTML code when mixed with JSX HOT 8
- [Feature Request] Provide a way to write optional code hide in comment HOT 3
- Getting wrong line numbers: "Including lines [NaN-NaN]" HOT 2
- ifdef-loader not reflecting in main.js
- #If #endif blocks highlighting in vscode
- ESLint bad indentation HOT 2
- not working with CRLF line ending file HOT 1
- Give a option to decide whether the loader is cacheable HOT 2
- Add #define HOT 1
- ifdef-uncomment-prefix reveal_code RegExp is incorrect HOT 1
- Upgrade to webpack 5 internally
- How to config for .ts file? HOT 2
- Has anyone gotten ifdef-loader to work with Angular 13? HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from ifdef-loader.