It seems that when I compile a monorepo on heroku, compiling works, but the files are not persisted.
I am currently consolidating my code to the following structure:
--server
--shared
--react-native
shared contains some js files that can be imported from both the server and react-native.
My package.json contains shared: '../shared'
Locally, i've used yarn link to work, although yarn install also works.(i've had to add symlinks: true to customConfig.resolve)
I'd be happy with any solution, but this was the closest I could get to:
My host is currently heroku. To push the current structure, i've used a monorepo buildpack which essentially moves server to the root, and dependencies one folder above that(allowing heroku to build rails as it normally does, from the root).
There are no error in the compilation, except one mention that webpack-cli isn't installed, and a prompt to install it(which heroku dismisses). It does however log that Compiled all packs to: tmp/build_XXX/public/packs
The app boots, but rendering fails on rendering the path, as indeed the public/path of the compiled app doesn't exist.
I've played around with a bunch of configs for some hours now(other buildpacks, compile:true, moving devDependencies and dependencies around, etc), with no luck, and am starting to be a bit desperate(and wondering if docker would solve this issue.. 馃).
I've put together as many details as seemed relevant here: https://gist.github.com/walidvb/da56d7983ff8108164d283b093de51a5
Thanks for any hints!
I've made a minimal repo that does not reproduce the exact error I am having on my main codebase, but shows what I am trying to accomplish. In this example, I get an error while building on heroku. rake assets:precompile works locally.
I encountered a similar issue and found that upgrading webpack-cli to 3.3.12 resolved my issue:
Before:
// package.json
"devDependencies": {
...
"webpack-cli": "3.3.11"
...
}
// yarn.lock
[email protected]:
version "3.3.11"
...
webpack-cli@^3.3.11:
version "3.3.12"
...
After:
// package.json
"devDependencies": {
...
"webpack-cli": "^3.3.12"
...
}
// yarn.lock
webpack-cli@^3.3.11, webpack-cli@^3.3.12:
version "3.3.12"
...
The following warning helped narrow this down slightly:
One CLI for webpack must be installed. These are recommended choices, delivered as separate packages:
- webpack-cli (https://github.com/webpack/webpack-cli)
The original webpack full-featured CLI.
We will use "yarn" to install the CLI via "yarn add -D".
Do you want to install 'webpack-cli' (yes/no):
yarn add -D webpack-cli
Specifically 'One CLI for webpack must be installed'
Digging into this, the only issue I found related was:
You might have an old version of webpack globally and the webpack-cli may not know where to pull the right version from
https://github.com/webpack/webpack/issues/7197#issuecomment-386523801
As the changelog for webpack-cli from 3.3.10 -> 3.3.12 didn't reveal anything:
https://github.com/webpack/webpack-cli/compare/v3.3.10...v3.3.12
Hopefully this solves your issue.
Most helpful comment
I encountered a similar issue and found that upgrading
webpack-clito3.3.12resolved my issue:Before:
After:
The following warning helped narrow this down slightly:
Specifically '
One CLI for webpack must be installed'Digging into this, the only issue I found related was:
As the changelog for
webpack-clifrom3.3.10 -> 3.3.12didn't reveal anything:https://github.com/webpack/webpack-cli/compare/v3.3.10...v3.3.12
Hopefully this solves your issue.