You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm still stuck with these same issues affecting require-less as a plugin that builds on top of require-css. It has a pluginBuilder, which requires the require-css pluginBuilder. This results in that pluginBuilder being built in.
Perhaps pluginBuilder loads can happen in a fresh / hidden context for the builds to avoid this?
Is this the same as #228? If so, then I would prefer to just keep the conversation in that ticket since it has more history. Not saying it will get solved, but we can reopen to consider more. If you want to take a look at a patch, that would probably help move it forward.
@jrburke thanks for the quick response. It is actually different to #228.
#228 was caused by using a pluginBuilder as a dependency as well, causing the pluginBuilder to fail. It could still be worth including a doc note about this with pluginBuilders.
The issue here is pluginBuilder dependencies being detected as module dependencies that need writing.
It's not a major issue as an excludeShallow fixes it, but it is important to get right at some point.
Great, I will dive in when I have the time, but I'm not massively prioritising it for the moment though.
OK, so the issue is the pluginModule has a dependency on module 'a', but the regular plugin does not depend on 'a', and nothing else in the build depends on 'a', but 'a' ends up in the build output. Workaround is to use an excludeShallow for 'a'.
This one is a bit tricky, as it would require keeping a separate dependency tree for the plugin, and for the builder, and attaching the plugin's dependency tree to the build output, while keeping the pluginBuilder separate.
Perhaps the pluginBuilder could be loaded in a separate context. It may take some work though, as we need to perserve the config used from the main build context. The work would be done in build/jslib/requirePatch.js.
Perhaps the pluginBuilder could be loaded in a separate context. It may take some work though, as we need to perserve the config used from the main build context. The work would be done in build/jslib/requirePatch.js.
This is exactly what I'd need for a plugin builder that has to pre-compile a client-side template language to JS functions as well. Currently I'm stuck with a manually cobbled together solution that hacks into some of the require and r.js internals to get it done, but it's ugly (and somewhat brittle).
Really would appreciate a decent official solution.
@rjgotten if you are using a pluginBuilder, then it should be enough to then just do an exclude: [] for any of the pluginBuilder dependencies that end up in the layer, hacking internals should not be required. While it would be nice to avoid that exclusion pattern, that is the best pathway with the existing code.
@jrburke
You'd think so, yes. But what if the regular build requires some of the same dependencies, only mapped to different physical files? That's exactly the kind of scenario I ended up with and it didn't quite work the way it should.
I have a different problem, but it sounds like using a separate context for the pluginBuilder might resolve it as well. It looks like relative URLs are being resolved in relation to the build's baseUrl instead of the plugin's directory.
In my case, I'm trying to use require-css, which defines pluginBuilder as './css-builder'. My workaround is to define paths for the necessary modules, but this is completely dependent on unstable details in the plugin's implementation. My r.js configuration looks something like this:
Activity
jrburke commentedon Oct 18, 2012
Is this the same as #228? If so, then I would prefer to just keep the conversation in that ticket since it has more history. Not saying it will get solved, but we can reopen to consider more. If you want to take a look at a patch, that would probably help move it forward.
guybedford commentedon Oct 18, 2012
@jrburke thanks for the quick response. It is actually different to #228.
#228 was caused by using a pluginBuilder as a dependency as well, causing the pluginBuilder to fail. It could still be worth including a doc note about this with pluginBuilders.
The issue here is pluginBuilder dependencies being detected as module dependencies that need writing.
It's not a major issue as an excludeShallow fixes it, but it is important to get right at some point.
Great, I will dive in when I have the time, but I'm not massively prioritising it for the moment though.
jrburke commentedon Oct 18, 2012
OK, so the issue is the pluginModule has a dependency on module 'a', but the regular plugin does not depend on 'a', and nothing else in the build depends on 'a', but 'a' ends up in the build output. Workaround is to use an excludeShallow for 'a'.
guybedford commentedon Oct 18, 2012
Yes, exactly.
guybedford commentedon Apr 24, 2013
I just wanted to bump this - it's a long standing issue on Require LESS (https://github.com/guybedford/require-less#builds), and affects all plugins made with the amd-loader builder.
Is there a path to a fix? Any clues would be appreciated for a pull request.
jrburke commentedon May 7, 2013
This one is a bit tricky, as it would require keeping a separate dependency tree for the plugin, and for the builder, and attaching the plugin's dependency tree to the build output, while keeping the pluginBuilder separate.
Perhaps the pluginBuilder could be loaded in a separate context. It may take some work though, as we need to perserve the config used from the main build context. The work would be done in build/jslib/requirePatch.js.
rjgotten commentedon Jan 14, 2014
This is exactly what I'd need for a plugin builder that has to pre-compile a client-side template language to JS functions as well. Currently I'm stuck with a manually cobbled together solution that hacks into some of the require and r.js internals to get it done, but it's ugly (and somewhat brittle).
Really would appreciate a decent official solution.
jrburke commentedon Jan 22, 2014
@rjgotten if you are using a pluginBuilder, then it should be enough to then just do an exclude: [] for any of the pluginBuilder dependencies that end up in the layer, hacking internals should not be required. While it would be nice to avoid that exclusion pattern, that is the best pathway with the existing code.
rjgotten commentedon Jan 23, 2014
@jrburke
You'd think so, yes. But what if the regular build requires some of the same dependencies, only mapped to different physical files? That's exactly the kind of scenario I ended up with and it didn't quite work the way it should.
leachryanb commentedon Feb 13, 2014
+1
jugglinmike commentedon Mar 5, 2014
I have a different problem, but it sounds like using a separate context for the pluginBuilder might resolve it as well. It looks like relative URLs are being resolved in relation to the build's
baseUrlinstead of the plugin's directory.In my case, I'm trying to use
require-css, which definespluginBuilderas'./css-builder'. My workaround is to define paths for the necessary modules, but this is completely dependent on unstable details in the plugin's implementation. My r.js configuration looks something like this:jrburke commentedon Mar 18, 2014
@jugglinmike for that case it sounds like using package config for require-css may work better.
jugglinmike commentedon Mar 19, 2014
@jrburke That did the trick. Now I understand the behavior of the package config--thanks!
miraclebg commentedon Mar 21, 2016
@jugglinmike Life-and-last-lost-hour saver!
jugglinmike commentedon Mar 22, 2016
@miraclebg Glad it helped!
chrisknoll commentedon Feb 22, 2017
Can you explain how using package config solved this issue?
zilingxingzi commentedon Sep 8, 2017