Roots Discourse

Sage 9 problems problems problems

Hi,
Have been testing out Sage 9 as I heard good things about it. But I only have been batteling problems after problem.
The things I wanted out of this was mainly live-watch for PHP and CSS, but that does not work anymore. Did work for CSS for a while, but not now.
So I have ben “yarn build” every time I have done any change, time consuming.

Now I can’t even “yard build” anymore. I am at the brink of moving everything back to a standard WP Custom Theme to get this project done in time. Or is there anyone that can help me out a bit?

Script phpcs handling the test event returned with error code 1
haffy@MBP-Haffy woonderland % yarn build
yarn run v1.22.5
$ webpack --progress --config resources/assets/build/webpack.config.js
[webpack-cli] Invalid configuration object. Webpack has been initialized using a configuration object that does not match the API schema.

  • configuration.devtool should match pattern “^(inline-|hidden-|eval-)?(nosources-)?(cheap-(module-)?)?source-map$”.
    BREAKING CHANGE since webpack 5: The devtool option is more strict.
    Please strictly follow the order of the keywords in the pattern.
  • configuration.resolveLoader has an unknown property ‘moduleExtensions’. These properties are valid:
    object { alias?, aliasFields?, byDependency?, cache?, cachePredicate?, cacheWithContext?, conditionNames?, descriptionFiles?, enforceExtension?, exportsFields?, extensions?, fallback?, fileSystem?, fullySpecified?, importsFields?, mainFields?, mainFiles?, modules?, plugins?, preferAbsolute?, preferRelative?, resolver?, restrictions?, roots?, symlinks?, unsafeCache?, useSyncFileSystemCalls? }
    -> Options object for resolving requests.
    error Command failed with exit code 2.
    info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

Most if not all issues stem from outdated dependencies/package rot.

  1. You should also try out Sage 10, it got new features and up to date dependencies.
    It is in master, but should be production-ready for some time.
  2. There is a webpack 4 + webpack 5 PR branch for Sage 9 with updated dependencies:
    https://github.com/roots/sage/pull/2607
    https://github.com/roots/sage/pull/2603

Make sure you’re running the version of node that Sage 9 works with:

nvm use 9

Then clear out your node_modules just to be safe:

rm -rf node_modules

Reinstall your node dependencies:

yarn

And then try building your project again:

yarn build

If you’re still seeing errors after doing all this, make sure you’ve followed the getting started docs for your operating system, and for Sage.

You may also want to try out the latest Sage 9.x branch: