Yarn run build:production doesn't build SASS & JavaScript

Running a Sage9 provisioned on trellis/bedrock.

Noticed that none of my SCSS, and JS, was active on my staging server after deploy (I have the build_before.yml deploy hook active), so I tried to run yarn run build:production locally in my theme’s folder. And… it does the same thing locally. yarn start and yarn run build both work like charms.

Any ideas?

1 Like

Something I only just discovered today. Try yarn run lint:styles and yarn run lint:scripts, they likely report errors the build and start won’t.

1 Like

Are you running into https://github.com/roots/sage/issues/2017? If so, QWp6t’s solution on there will work

Here’s the return of yarn run lint:styles and yarn run lint:scripts:

yarn run lint:scripts        ✔  930  13:49:35
yarn run v1.5.1
$ eslint resources/assets/scripts resources/assets/build
✨  Done in 1.08s.
yarn run lint:styles         ✔  929  03:40:42
yarn run v1.5.1
$ stylelint "resources/assets/styles/**/*.{css,sass,scss,sss,less}"
✨  Done in 1.85s.

I don’t think I’m running into Giovanni-Mattucci’s issue. I can’t seem to recreate that output.

Here is the original output to yarn run build:production normally:

yarn build:production
yarn run v1.5.1
$ webpack --progress -p --config resources/assets/build/webpack.config.js
 95% emitting                                                                 i
 DONE  Compiled successfully in 7912ms                                2:02:50 PM

                         Asset       Size  Chunks             Chunk Names
      scripts/main_62fac8f1.js    71.9 kB       0  [emitted]  main
scripts/customizer_62fac8f1.js  760 bytes       1  [emitted]  customizer
      styles/main_62fac8f1.css     184 kB       0  [emitted]  main
                   assets.json  161 bytes          [emitted]
✨  Done in 11.61s.

The output after setting parser: undefined in the postcss.config.js file:

yarn build:production
yarn run v1.5.1
$ webpack --progress -p --config resources/assets/build/webpack.config.js
 95% emitting                                                                 o
 DONE  Compiled successfully in 1153ms                                2:04:52 PM

                         Asset       Size  Chunks             Chunk Names
      scripts/main_62fac8f1.js    71.9 kB       0  [emitted]  main
scripts/customizer_62fac8f1.js  760 bytes       1  [emitted]  customizer
      styles/main_62fac8f1.css     184 kB       0  [emitted]  main
                   assets.json  161 bytes          [emitted]
✨  Done in 4.40s.

Also, here’s the output for yarn run build:

yarn run build           1 ↵  932  13:55:45
yarn run v1.5.1
$ webpack --progress --config resources/assets/build/webpack.config.js
 95% emitting

 DONE  Compiled successfully in 3031ms                                              2:07:55 PM

                     Asset     Size  Chunks                    Chunk Names
images/hero-background.png  1.73 MB          [emitted]  [big]
           scripts/main.js   270 kB       0  [emitted]  [big]  main
     scripts/customizer.js  3.25 kB       1  [emitted]         customizer
           styles/main.css   234 kB       0  [emitted]         main
       scripts/main.js.map   413 kB       0  [emitted]         main
       styles/main.css.map   417 kB       0  [emitted]         main
 scripts/customizer.js.map  3.07 kB       1  [emitted]         customizer
✨  Done in 6.00s.

Noticing some files omitted in the :production process as opposed to this one. However, I’m not sure if thats relevant or if it’s supposed to output that way.

I couldn’t recreate his issue, however I added QWp6t’s fix anyways and it worked!