Comments (8)
QuickStart should not try to follow browser fields that do not appear in program code.
from asap.
The thing is, it cannot know if the browser key does not appear in the program code, short of making browser keys absolute paths only (which, by the way goes against the proposed spec).
Say you route "a": "b"
, and you require("c")
I need to first resolve "c"
(say it resolves to "SOME_PATH/c.js"
) and then I need to resolve "a"
too, to see if it resolves to "SOME_PATH/c.js"
also, which it totally could, since there could be another browser key rule down the require line to make that happen.
from asap.
Whatever browserify does, you should do.
from asap.
Even if the approach is not "correct" though?
Another easier example to show the logic around this:
in package.json
"browser": {
"./folder": "./folder-browser.js"
}
your package ./lib/file
`require("../folder")`
The "correct" approach is to resolve "../folder"
first (which, say, resolves to "./folder/file.js"
) then look at browser, and resolve "./folder"
to see if it resolves to "./folder/file.js"
and if a match is found, route it to "./folder-browser.js"
.
The Browserify approach is to simply not allow the key-part of the browser field to be resolveable, therefore in Browserify, this needs to be the package.json:
"browser": {
"./folder/file.js": "./folder-browser.js"
}
from asap.
Compatible is correct. Incompatible is incorrect.
from asap.
I don't necessarily disagree about compatibility, but we digress. The route is still invalid, and having an invalid route in the project just because Browserify is relaxed about routes is a bit meh. The real issue is not how Browserify calculates routes, the real issue is that Browserify does not care if a route does not exist. I was trying to explain why all routes should be resolvable from a logical point of view.
from asap.
The route is resolvable in development, which is one scenario in which browserify is used. It is not resolvable when used as a dependency, which is another scenario in which browserify is used. The browser field spec chose not to create separate "browserDev"
and "browser"
fields, but instead to just be relaxed about how it works.
from asap.
Adding tests back to the deployed package is not an option. I am sympathetic to the issue, but it is worth pushing back on incompatible tooling in this case.
from asap.
Related Issues (20)
- Browserify Support HOT 15
- Cross library interleaving can cause node 10's nextTick limit to be hit. HOT 1
- Publish a new version HOT 4
- function to change rawAsap.capacity value must be added HOT 3
- Consider using Promise.prototype.then HOT 4
- asap queue can be effectively overflown (using [email protected]) HOT 2
- Usability in development mode with thrown errors HOT 5
- Microtask queue can be made faster HOT 4
- asap uses timer, not MutationObserver, in Safari HOT 1
- react-native throw Error when importing asap HOT 8
- Chrome + postMessage = slow HOT 1
- Source is poinitng to internal uber repo HOT 3
- npm published version 2.05 is not in git HOT 1
- Browser-asap requiring wrong raw file (non-browser version). HOT 4
- Does asap have an ECCN? HOT 2
- Contributors? HOT 1
- Use queueMicrotask? HOT 2
- esbuild fails: "browser" field is not according to spec
- TypeError: t.observe is not a function. (In 't.observe(l,{characterData:!0})', 't.observe' is undefined) HOT 2
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 asap.