mariusbalcytis / webpack-bundle

Bundle to Integrate Webpack into Symfony
MIT License
122 stars 36 forks source link

Webpack 5 compatibility #97

Closed vbartusevicius closed 3 years ago

vbartusevicius commented 3 years ago

With hot update, webpack 5 emits two JS files for single entry-point of which first one is only needed.

96726600-c848ef80-13ba-11eb-8587-a7003c85cbb7

vbartusevicius commented 3 years ago

@mariusbalcytis - I see tests are failing - checked locally and see this:

valentas@valentas:~/Projects/webpack-bundle$ vendor/bin/codecept run functional CommonsChunkCest -vvv
Cannot load Zend OPcache - it was already loaded
Codeception PHP Testing Framework v2.5.6
Powered by PHPUnit 7.5.20 by Sebastian Bergmann and contributors.
Running with seed: 

Functional Tests (1) ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Modules: \Helper\Functional, Filesystem
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
CommonsChunkCest: Get few different chunks from groups
Signature: CommonsChunkCest:getFewDifferentChunksFromGroups
Test: tests/functional/CommonsChunkCest.php:getFewDifferentChunksFromGroups
Scenario --
 I clean up 
 I boot kernel with "commons_chunk"
 I run command "maba:webpack:setup"
  Dumped default package to /home/valentas/Projects/webpack-bundle/tests/functional/Fixtures/package.json
  Dumped default webpack config to /home/valentas/Projects/webpack-bundle/tests/functional/Fixtures/app/config/webpack.config.js
  yarn install v1.16.0
  warning package.json: No license field
  info No lockfile found.
  warning No license field
  [1/4] Resolving packages...
  warning node-sass > request@2.88.2: request has been deprecated, see https://github.com/request/request/issues/3142
  warning node-sass > request > har-validator@5.1.5: this library is no longer supported
  warning node-sass > node-gyp > request@2.88.2: request has been deprecated, see https://github.com/request/request/issues/3142
  [2/4] Fetching packages...
  error assets-webpack-plugin@3.10.0: The engine "node" is incompatible with this module. Expected version ">=10.x.x". Got "8.16.0"
  error Found incompatible module.
  info Visit https://yarnpkg.com/en/docs/cli/install for documentation about this command.

  Error running yarn install (exit code 1)! Please look at the log for errors and re-run command.

  Additional actions needed

  I would suggest to add the following into your git repository:
  git add package.json app/config/webpack.config.js yarn.lock

  I would also suggest to add node_modules directory into .gitignore:
  echo "node_modules" >> .gitignore

  Run maba:webpack:compile to compile assets when deploying.

  Always run maba:webpack:dev-server in dev environment.

The error The engine "node" is incompatible with this module. Expected version ">=10.x.x". Got "8.16.0" looks odd, as I have node version v12.18.3

vbartusevicius commented 3 years ago

Thankfully the assets-webpack-plugin@6 got webpack-5 compatibility and everything works fine!