All worked well until I had the unhealthy idea of run yarn outdated and it shown me the outdated dependencies.
So I updated them and now when I run yarn encore dev I get this error:
Entry module not found: Error: Can't resolve 'babel-loader'
How can I solve this?
Trying to reset dependencies to their old version doesn't work.
I think it is related to something about Webpack (reading online something about the error), but I'm not so experienced with it to solve the error on my own.
My current configuration is this:
Encore
// directory where all compiled assets will be stored
.setOutputPath('web/build/')
// what's the public path to this directory (relative to your project's document root dir)
.setPublicPath('/build')
// empty the outputPath dir before each build
.cleanupOutputBeforeBuild()
// will output as web/build/app.js
.addEntry('main', './src/AppBundle/Resources/assets/js/_main.js')
// will output as web/build/global.css
.addStyleEntry('global', './src/AppBundle/Resources/assets/css/_global.scss')
// allow sass/scss files to be processed
.enableSassLoader()
// allow legacy applications to use $/jQuery as a global variable
.autoProvidejQuery()
.enableSourceMaps(!Encore.isProduction())
// create hashed filenames (e.g. app.abc123.css)
.enableVersioning()
// Enable react
.enableReactPreset()
.configureBabel((config) => {
config.presets.push('stage-3')
})
;
UPDATE
I read the yarn.lock file and I saw that there is a dependency on babel-loader: "^7.1.0" required by @symfony/webpack-encore@^0.17.1.
So I gone to my node_modules folder and looked for the package but it wasn't in the folder!
So I ran yarn add babel-loader and Yarn installed the package: It simply wasn't installed!
Now the command yarn encore dev works again, but the real question now is:
Why babel-loader wasn't installed also if required by the yarn.lock?
Hey there! Hmm, it sounds like some weird yarn problem, honestly. At times, it seems that the node_modules directory can have the wrong files. Occasionally, I’ll completely remove the node_modules directory and run “yarn install” fresh. That’s my best guess: as you saw, we require that module, so it should be there :)
I think there’s nothing to be done here in this lib.
Cheers!
Yes, I think this, too... Thanks for closing the issue in my place :)
I got the same problem. I just delete my node_modules , update my netlify-lambda package.
and everything run number one now.
Most helpful comment
Hey there! Hmm, it sounds like some weird yarn problem, honestly. At times, it seems that the node_modules directory can have the wrong files. Occasionally, I’ll completely remove the node_modules directory and run “yarn install” fresh. That’s my best guess: as you saw, we require that module, so it should be there :)
I think there’s nothing to be done here in this lib.
Cheers!