Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Packages not being able to access their own assets at first run of the app that uses them #2606

Closed
tanis2000 opened this Issue Sep 16, 2014 · 16 comments

Comments

Projects
None yet
9 participants
@tanis2000
Copy link

tanis2000 commented Sep 16, 2014

If you use Package._transitional_registerBuildPlugin to run arbitrary code at build time when the package is being deployed inside an app, the first time the handler is being run, the .meteor/local/build folder with the content of the packages is not yet there and the package itself cannot access its own files.

The second time you run meteor, it will work as expected as the files have been copied there at the end of the first run.

If you run meteor reset this happens again as the folder is cleaned up.

Is there a different solution or is it a bug? Is there any workaround?

@mizzao

This comment has been minimized.

Copy link
Contributor

mizzao commented Sep 16, 2014

Possibly related to #2506, #1193.

@tanis2000

This comment has been minimized.

Copy link
Author

tanis2000 commented Sep 17, 2014

@mizzao @glasser
As far as I can tell, it looks like the package handler function is being called only because it's triggered by the extension you've registered with Plugin.registerSourceHandler.

But the first time the handler is triggered, there are no files yet in the .meteor/local/build folder. So, if you need to access the resources there from within the handler it will fail with an ENOENT as the files are not yet there.

It might just be a problem with the order steps are being executed during build time.

@n1mmy

This comment has been minimized.

Copy link
Member

n1mmy commented Sep 23, 2014

It sounds like this is working as intended. The .meteor/local/build/ is the build output directory. When you build the second time, the results of your first build are available. Generally, a build plugin should not rely on the output of a previous build as the input to the next build.

@n1mmy n1mmy closed this Sep 23, 2014

@tanis2000

This comment has been minimized.

Copy link
Author

tanis2000 commented Sep 24, 2014

@n1mmy if that's the way it's intended to work, how can you access the assets of a build plugin from the plugin itself? What's the correct way?

@mizzao

This comment has been minimized.

Copy link
Contributor

mizzao commented Sep 24, 2014

@tanis2000 in #2506 I suggested being able to access files in the package's subdirectory. I'm not sure about being able to access the build output as that is something that should be internal to Meteor and not have to be externally documented.

@tanis2000

This comment has been minimized.

Copy link
Author

tanis2000 commented Sep 24, 2014

@mizzao what you suggest would be a perfect fit for what I'm trying to do. I was using the build output folder as I had no idea how to access the package's folder. But as far as I can see, there still isn't a proper (un)documented way. How are you getting around that?

@mizzao

This comment has been minimized.

Copy link
Contributor

mizzao commented Sep 24, 2014

We aren't; we're making incremental dumb updates for each internal Meteor API change as in

There are both client side and server side changes that have to done, I opened #2392 a long time ago but the issues in it seem to have been largely overlooked.

@tanis2000

This comment has been minimized.

Copy link
Author

tanis2000 commented Sep 24, 2014

You're actually luckier than me as you have a sort of workaround for most issues. But in my case I have to be able to access the assets of the package during the build phase (aka the first time Meteor starts, or after a meteor reset, or when you run meteor build). But at that time the .meteor/local folder is not yet there so I have no way of reading the files of my package.

@reywood

This comment has been minimized.

Copy link

reywood commented Oct 21, 2014

@n1mmy The underlying point of this issue has been sidestepped. It appears there is no way for a package and/or the meteor app that houses it to access the package's files at build time. Is this correct? If so, are there plans to make these files available at build time?

@n1mmy

This comment has been minimized.

Copy link
Member

n1mmy commented Oct 21, 2014

@reywood Yeah, that's right. There isn't currently an API for packages to access assets at build time. I know it's frustrating. Sorry. We do plan to revisit APIs for package building (some preliminary thought is here: https://meteor.hackpad.com/New-control-file-brainstorming-ZDBMiEQ6DZl), though no exact timeline for that yet.

@gbhatnag

This comment has been minimized.

Copy link

gbhatnag commented Oct 6, 2015

This is still happening on Meteor 1.2.0.2 with the https://github.com/meteoric/ionic-sass project. Ionic-sass compiles files that are pointed to by client/ionic.scss. For a while, this only happened the very first time running the server. Not it's happening every time, even though I can see the files are clearly there.

This may also be an issue with fourseven:scss: https://github.com/fourseven/meteor-scss -- the SCSS processor.

@myrtleTree33

This comment has been minimized.

Copy link

myrtleTree33 commented Oct 16, 2015

@myrtleTree33

This comment has been minimized.

Copy link

myrtleTree33 commented Oct 16, 2015

@gbhatnag this fix worked for me meteoric/ionic-sass#16

@codeHatcher

This comment has been minimized.

Copy link

codeHatcher commented Oct 28, 2015

Can confirm, this is still happening.

@YonasBerhe

This comment has been minimized.

Copy link

YonasBerhe commented Jan 21, 2016

+1

@1seck

This comment has been minimized.

Copy link

1seck commented Sep 2, 2016

Hi there,

did anyone upload his/her meteoric utilizing app to apple's app store with success?
It does not yield a functioning app, for the same reason it won't compile scss, Androids Play Store is fine.

Regards

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.