Giter VIP home page Giter VIP logo

Comments (12)

medikoo avatar medikoo commented on June 13, 2024

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.

Phoscur avatar Phoscur commented on June 13, 2024

It seems Firefox(Firebug) and Webkit support it.

from modules-webmake.

Phoscur avatar Phoscur commented on June 13, 2024

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.

medikoo avatar medikoo commented on June 13, 2024

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.

Phoscur avatar Phoscur commented on June 13, 2024

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.

medikoo avatar medikoo commented on June 13, 2024

Nice :)
It would be great to have it as option in webmake. Can you send pull request with that ?

from modules-webmake.

Phoscur avatar Phoscur commented on June 13, 2024

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.

medikoo avatar medikoo commented on June 13, 2024

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.

medikoo avatar medikoo commented on June 13, 2024

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 under bar path, then for index.js in foo package it would be node_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.

Phoscur avatar Phoscur commented on June 13, 2024

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.

medikoo avatar medikoo commented on June 13, 2024

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.

medikoo avatar medikoo commented on June 13, 2024

So version that outputs source maps with paths as suggested in first option is out :)

from modules-webmake.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.