Can you use a browser without linking?

I have many colleagues and friends with existing brown fields, dirty javascript applications who would like to start the transition to some kind of modular js system. I tried to help them in the past by showing them how to reorganize on requirejs, but I'm starting to think that this is a bad approach.

Usually the problem is that the nature of their globally collaborative code contradicts the asynchronous nature of AMD and, as far as I think, AMD’s approach, they have more problems than in my lectures on the “correct” way to load a module.

Browserify, meanwhile, removes asynchronous browsing and is simpler, but adds a whole build step. For people who do not use binding or any kind of build process (or just the default in visual studio), this again is too much overhead.

So what I really want is a simple module system that allows people to define and require things. This is a half-step step towards proper functioning; they can include their dependencies with regular script tags and define them manually in the module system. I even wrote such a system because ... hey, it's very simple.

Today, someone pointed out to me that for this you only need to use parts of the Browserify browser on the client side. I agree. However, I can not find any documentation anywhere and not just a browser client side browser.

+8
javascript client-side browserify
source share
3 answers

After I sat down and analyzed the built-in browser file, I came to the conclusion that no, what I want to do is not possible.

On the one hand, the browser does not show the define keyword or even require. On the other hand, it does some minor rewrites of combined modules, which would be very difficult to achieve at runtime.

+1
source share

I came across a dynamic module loader that works well with Browserify. You can use it for development to “require” globally on the client side. It works great.

https://github.com/manvalls/drq

0
source share

The solution to your problem could be:

https://github.com/LarsBV/browser-node-loader

I wrote this due to various sourcemap errors in browsers and too many / alternative configurations in gulp / browsify / watchify.

It has a build step, but it needs to be run only if there are new dependencies.

I do not recommend this approach for production, but it is much easier to develop.

This is very new and untested in everything except the last chrome, firefox, with some settings in the generated script, I think it will work even in ie6.

-2
source share

All Articles