Comments (12)
Yeah, very good point, we definitely need to add that, however I'm still not sure how it can been done.
Is it just an idea or support for source maps is already in browsers ?
from modules-webmake.
It seems Firefox(Firebug) and Webkit support it.
from modules-webmake.
So far, my tries are unsuccessful:
@ parser.js line 59
'eval(' + stringify(';' + module[name] + '\n//@ sourceurl=' + name) + ')' +
Produces working output, but chrome dev tools just show some weird contentscript2/3.js files and firebug complains eval without return.
Maybe I just never used eval (because it's evil) and now I don't even know how to use it. xD
Can you take a look into it?
Also I'm missing closure inspector for my firebug, it seems it's not compatible with my waterfox 10...
from modules-webmake.
hmm.. maybe it's case sensitive and should rather be sourceURL
? I'll try to test it tomorrow morning in my application
from modules-webmake.
Ahaha. Now it works in chrome. Nice!
@ parser.js line 59
'eval(' + stringify(module[name] + '\n//@ sourceURL=' + name) + ')' +
Try it, looks nice in chrome dev tools :D
from modules-webmake.
Nice :)
It would be great to have it as option in webmake. Can you send pull request with that ?
from modules-webmake.
Yeah sure, I can do that.
I would like to add the full project relative path to the sourceURL though, and atm I don't know how I could get that one in
parser.js method modulesToString.
Can you help me out?
from modules-webmake.
Sure,
Currently path is relative to package root, or to topmost module path.
Do you keep your project as package (any package.json or node_modules in top level project folder) ?
from modules-webmake.
Getting back to our conversion on im.
I think best solution would be to provide three possible path modes for sourceURL (developer will choose which one he/she prefers)
- One I suggested which always starts with package name e.g.
foo/lib/index.js
- Absolute path e.g.
/Users/john/Projects/bar/node_modules/foo/lib/index.js
- Relative path up to topmost used directory - this one will generate path you expected, so e.g. if all modules used by
bar
project are underbar
path, then forindex.js
infoo
package it would benode_modules/foo/lib/index.js
For now we may make just first option (I think it's best) however implementation of all of them is also possible
from modules-webmake.
Spent some time on this, couldn't even get the first option to work.
Your idea with new String(content) and then appending attributes breaks webmake as new String() is typeof "object".
It seems the right way to go is to refactor and create a Module object with composite pattern, the modulesToString function "smells" like it. We are missing a data-structure for the modules anyways, this could later be used for caching.
from modules-webmake.
ok, I'll try if it's possible to have first option for a meantime, and we will implement all of them with refactored webmake internals (I hope to see this by end of march)
from modules-webmake.
So version that outputs source maps with paths as suggested in first option is out :)
from modules-webmake.
Related Issues (20)
- Text and HTML extensions? HOT 4
- Lazy-loading modules? HOT 1
- Bower package? HOT 5
- Support input from stdin HOT 2
- Parse error for scripts with a shebang HOT 3
- cant find module although module is their HOT 1
- Local modules and stdin causes webmake to hang HOT 2
- Requires local installation HOT 1
- Ability to validate or transform each included file HOT 3
- Errors in extensions are not returned to webmake HOT 3
- Extension for EJS HOT 2
- Can't set global export name programmatically ('name' option) HOT 2
- Extensions don't work for js files HOT 7
- Wrong transformation for empty module for special case HOT 1
- Cannot bundle module 'promise' HOT 3
- Nonexistence of node_modules makes wrong paths HOT 3
- It is possible to perform tree shaking for bundled module? HOT 1
- deprecated library during installing HOT 2
- Comparison ... may cause unexpected type coercion HOT 4
- How to use the fs node module with this? HOT 3
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 modules-webmake.