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
{{ message }}
This repository has been archived by the owner on Jun 15, 2023. It is now read-only.
I'm trying to add a prefix to a module registration path using nameCleaner. The path is not changed.
Details:
I'm working with Fable, an F#-to-js compiler. Output JS goes in build/dist. Unfortunately, there is a F# file in one of the node modules that also needs to get compiled to js, and Fable puts the output in a node_modules directory under my output directory. So my file tree looks like this:
app/
assets/
Components.fs
build/
dist/
app/ [my code here, including Components.js]
node_modules/
fable-import-react/ [Fable.Helpers.React.js and package.json here]
node_modules/
fable-import-react [Fable.Helpers.React.fs and package.json here]
I use brunch to post-process. Here is the essential brunch configuration:
Components.js:5 Uncaught Error: Cannot find module 'build/dist/node_modules/fable-import-react/Fable.Helpers.React' from 'build/dist/app/Components.js'
Expected behavior
I believe the nameCleaner statement should change the require.register statement to prepend build/dist/node_modules/ to fable-import-react. However, it doesn't modify that statement at all (maybe because the module is under node_modules?).
[Edit: I've added to the branch the JS files compiled by Fable, as well as the node modules that are not in npm yet, so you shouldn't need to compile any F# in order to troubleshoot the issue.]
You should be able to do the build in the project directory this way:
Regrettably, two things have happened since I filed this issue: First, I've had to abandon development with Fable owing to other issues, and second, my custom version of Fable that includes the modules needed to make the demo work no longer builds. I think that if 2.15.5 is not supported, that is sufficient to close this issue.
Description
I'm trying to add a prefix to a module registration path using nameCleaner. The path is not changed.
Details:
I'm working with Fable, an F#-to-js compiler. Output JS goes in
build/dist
. Unfortunately, there is a F# file in one of the node modules that also needs to get compiled to js, and Fable puts the output in anode_modules
directory under my output directory. So my file tree looks like this:I use brunch to post-process. Here is the essential brunch configuration:
Note the nameCleaner. This is because app.js is generated with
but when the module is imported the require statement looks like this:
which results in:
Expected behavior
I believe the nameCleaner statement should change the
require.register
statement to prependbuild/dist/node_modules/
tofable-import-react
. However, it doesn't modify that statement at all (maybe because the module is undernode_modules
?).If I change the nameCleaner to do this:
The prefix is removed from the
require.register
statement for theComponent
module, so I know the nameCleaner can remove prefixes successfully.Note also that it doesn't make any difference if I use a regex pattern or a simple string in the nameCleaner replace; neither prepends the prefix.
Actual behavior
The prefix is not prepended to the module when it is registered.
GitHub demo: https://github.com/psfblair/fable_redux_skeleton on branch
brunch-problem
[Edit: I've added to the branch the JS files compiled by Fable, as well as the node modules that are not in npm yet, so you shouldn't need to compile any F# in order to troubleshoot the issue.]
You should be able to do the build in the project directory this way:
Environment
package.json
contentsbrunch config contents
Other useful files, when present (log,
bower.json
etc.)See the demo code on GitHub.
The text was updated successfully, but these errors were encountered: