Closed wclr closed 8 years ago
Cool, so is the idea of this project to facilitate moving all assets (not just steal but including steal) into a production folder and then updating bundlesPath? I think this is what you're doing.
So probably for this project you would want to be able to prevent steal-tools from writing to the filesystem, right? I'm guessing you clean that up manually. There's actually a way to do this now although it's not completely user-friendly at this point.
Awesome to see projects building on top of steal-tools! I'm guessing this is how you found #260.
As for the error, I'm not sure exactly. Let me pull down your project and test it out.
Yes it would be nice to get rid of fs bundles (it would allow to set correct bundlesPath witch it sould be in production)
The problem currentlty with mode when steal is not bundled in main bundle (packBundle option packSteal: true
),
so main module say web/app
is turned to web-app-d460f06a
so in index.html in this case:
<script src="/assets/steal.production-dc661381.js" data-main="web-app-d460f06a" data-bundles-path="."></script>
packBundles also adds in the end of file (without it app is not importing)
System.import('package.json!npm').then(function(){
System.import("web/app");
})
In this case app is loaded normally and works, but in console there is an error, something like:
Potentially unhandled rejection [2] TypeError: "jquery@2.1.4#dist/jquery" already exists in the module table
Sounds like you have some double-loading going on. I would advise against setting data-main to "web-app-d460f06a". The name of your main is still web/app
, the location is just different. You should be updated the bundlesConfig that gets generated. It should be at the top of your main bundle and be System.bundle = { ... }. It's a mapping of each bundle and which modules are included. Your script should look like:
<script src="/assets/steal.production-dc661381.js" data-main="web/app" data-config="package.json!npm" data-bundles-path="."></script>
why data-config="package.json!npm"
need to be here? If we have just data-main="web/app"
how it is possible to hash it?
Oh, right. So in this case it might be a race condition happening. Forget my last comment (keep your script tag as it was) and instead change:
System.import('package.json!npm').then(function(){
System.import("web/app");
})
to:
steal.import("web/app");
This should wait for the bundle to be loaded. Let me know.
Well that works the same way. App is loaded but the same errors in console are in place.
Arg, then it's not the issue i would have thought. So I can test this by pulling down your project and running npm test? I'll take a look later if so.
Yes if you run npm install
then npm test
(mocha
is needed globally) it will build the app in public
, that run some static server (for example harpjs.com - harp server public
and access localhost:9000
) in console you should see the errors and strange behaviour that detached-module
is loaded twice.
@matthewp I've updated https://github.com/whitecolor/steal-pack-bundles#tests instructions, so you can eseally navigate throught there result and see the errors in console (packed and built version have them) And modules are imported twice (I belive there is a problem with global
modules)
Haven't you tried?
I just did, I do not get errors when looking at /packed/index.html but I do see the double loading. That's caused because there is only 1 define in the bundle, so we should be able to fix that. Please file that in stealjs/steal, want to keep the issues separated and concise.
Well I think this error are due double loading.
@matthewp There is a module that we use to pack bundles after steal build: https://github.com/whitecolor/steal-pack-bundles
1) Please take a look at it and maybe you would have some advice how it can improved and what do you think about the need of such thing.
2) if you clone the repo and run test (
npm test
) then start some static server to serverpublic
folder (that will appear after test build) you will see some erros in the cosole:Could you elaborate what they mean?