Reputation: 629
When attempting to compile I get the following errors for all images:
rails assets:precompile
ModuleNotFoundError: Module not found: Error: Can't resolve 'core-js/modules/es.symbol' in '/***/app/javascript/packs'
Field 'browser' doesn't contain a valid alias configuration
/*/app/javascript/core-js/modules/es.symbol.scss doesn't exist
.css
Field 'browser' doesn't contain a valid alias configuration
/*/app/javascript/core-js/modules/es.symbol.css doesn't exist
.module.sass
Field 'browser' doesn't contain a valid alias configuration
/*/app/javascript/core-js/modules/es.symbol.module.sass doesn't exist
.module.scss
Field 'browser' doesn't contain a valid alias configuration
/*/app/javascript/core-js/modules/es.symbol.module.scss doesn't exist
.module.css
Field 'browser' doesn't contain a valid alias configuration
/*/app/javascript/core-js/modules/es.symbol.module.css doesn't exist
.png
Field 'browser' doesn't contain a valid alias configuration
/*/app/javascript/core-js/modules/es.symbol.png doesn't exist
.svg
so I get
Webpacker::Manifest::MissingEntryError in Pages#home
I have installed webpacker by adding in my gemfile
gem 'webpacker'
and
bundle
bundle exec rails webpacker:install
yarn upgrade
yarn install
The folder packs in app/javascript was not created, so I created it myself and added my current application.js which was in app/assets to app/javascript/packs/
I added this to the top of the file:
import 'core-js/stable'
import 'regenerator-runtime/runtime'
const images = require.context('../images', true)
const imagePath = (name) => images(name, true)
And I did replace all tags with
javascript_pack_tag
or
asset_pack_path
but my manifest file looks anyways like:
{
"application.js": "/packs/js/application-e4e1539847422.js",
"application.js.map": "/packs/js/application-e4e15391747422.js.map",
"entrypoints": {
"application": {
"js": [
"/packs/js/application-e4e15391a97422.js"
],
"js.map": [
"/packs/js/application-e4391598747422.js.map"
]
}
}
}
Without changing anything apparently the images get compiled correctly and when I Have access to my app the javascript does not work.
Upvotes: 5
Views: 1443
Reputation: 193
Delete this files and folders:
/node_modules
/tmp/cache
yarn.lock
Gemfile.lock
and then run:
bundle install
rails webpacker:install
rails assets:precompile
rails webpacker:compile
Upvotes: 3