0

Error: Unexpected '!'. Escaping special characters with \ may help. - Preact build failing with no location

errorcode

Preact production build is failing without giving any error location after additional chunk assets processing

Going after all '!' manually seems to be the only way I can think of right now!

nvm 12.18.3
ubuntu 20.04

npm run build

> cdms-app@0.0.1 build /home/technative/Documents/Projects/CrystalDevDocker/cdms-app
> preact build --no-prerender --dest public --esm --analyze --verbose

⚠ WARN Could not find sw.js in /home/technative/Documents/Projects/CrystalDevDocker/cdms-app/src. Using the default service worker.
⚠ WARN /home/technative/Documents/Projects/CrystalDevDocker/cdms-app/prerender-urls.json doesn't exist, using default!
Uh oh AssertionError [ERR_ASSERTION]: Unable to find a place to inject the manifest. Please ensure that your service worker file contains the following:/(\.precacheAndRoute\()\s*\[\s*\]\s*(\)|,)/
   at Object._callee$ (/home/technative/Documents/Projects/CrystalDevDocker/cdms-app/node_modules/workbox-build/build/entry-points/inject-manifest.js:82:13)
   at tryCatch (/home/technative/Documents/Projects/CrystalDevDocker/cdms-app/node_modules/babel-runtime/node_modules/regenerator-runtime/runtime.js:62:40)
   at Generator.invoke [as _invoke] (/home/technative/Documents/Projects/CrystalDevDocker/cdms-app/node_modules/babel-runtime/node_modules/regenerator-runtime/runtime.js:296:22)
   at Generator.prototype.<computed> [as next] (/home/technative/Documents/Projects/CrystalDevDocker/cdms-app/node_modules/babel-runtime/node_modules/regenerator-runtime/runtime.js:114:21)
   at step (/home/technative/Documents/Projects/CrystalDevDocker/cdms-app/node_modules/babel-runtime/helpers/asyncToGenerator.js:17:30)
   at /home/technative/Documents/Projects/CrystalDevDocker/cdms-app/node_modules/babel-runtime/helpers/asyncToGenerator.js:28:13 {
 generatedMessage: false,
 code: 'ERR_ASSERTION',
 actual: null,
 expected: true,
 operator: '=='
}
Build  [=     ] 10% (1.4s) buildingNodent: Warning - noNodentExtensions option requires acorn >=v4.x. Extensions installed.
Build  [=     ] 12% (7.4s) building[BABEL] Note: The code generator has deoptimised the styling of /home/technative/Documents/Projects/CrystalDevDocker/cdms-app/src/components/createvisitmodal/index.js as it exceeds the max of 500KB.
Build  [=   ] 15% (171.5s) building[BABEL] Note: The code generator has deoptimised the styling of /home/technative/Documents/Projects/CrystalDevDocker/cdms-app/src/routes/siloAdministration/index.js as it exceeds the max of 500KB.
Build  [=   ] 15% (271.8s) building[BABEL] Note: The code generator has deoptimised the styling of /home/technative/Documents/Projects/CrystalDevDocker/cdms-app/src/routes/caseDetail/index.js as it exceeds the max of 500KB.
Build  [=   ] 17% (289.7s) building[BABEL] Note: The code generator has deoptimised the styling of /home/technative/Documents/Projects/CrystalDevDocker/cdms-app/node_modules/pdfmake/build/vfs_fonts.js as it exceeds the max of 500KB.
Build  [==  ] 40% (289.8s) building[BABEL] Note: The code generator has deoptimised the styling of /home/technative/Documents/Projects/CrystalDevDocker/cdms-app/node_modules/pdfmake/build/pdfmake.js as it exceeds the max of 500KB.
Build  [==  ] 40% (377.0s) building[BABEL] Note: The code generator has deoptimised the styling of /home/technative/Documents/Projects/CrystalDevDocker/cdms-app/src/components/semiDetailView/index.js as it exceeds the max of 500KB.
Build  [====] 90% (487.8s) additional chunk assets processing[BABEL] Note: The code generator has deoptimised the styling of /home/technative/Documents/Projects/CrystalDevDocker/cdms-app/src/components/createvisitmodal/index.js as it exceeds the max of 500KB.
[BABEL] Note: The code generator has deoptimised the styling of /home/technative/Documents/Projects/CrystalDevDocker/cdms-app/src/routes/siloAdministration/index.js as it exceeds the max of 500KB.
[BABEL] Note: The code generator has deoptimised the styling of /home/technative/Documents/Projects/CrystalDevDocker/cdms-app/src/routes/caseDetail/index.js as it exceeds the max of 500KB.
[BABEL] Note: The code generator has deoptimised the styling of /home/technative/Documents/Projects/CrystalDevDocker/cdms-app/node_modules/pdfmake/build/pdfmake.js as it exceeds the max of 500KB.
[BABEL] Note: The code generator has deoptimised the styling of /home/technative/Documents/Projects/CrystalDevDocker/cdms-app/node_modules/pdfmake/build/vfs_fonts.js as it exceeds the max of 500KB.
[BABEL] Note: The code generator has deoptimised the styling of /home/technative/Documents/Projects/CrystalDevDocker/cdms-app/src/components/semiDetailView/index.js as it exceeds the max of 500KB.


Build failed! 

Error: Unexpected '!'. Escaping special characters with \ may help.
  • 1
    Do you have a ! inside a content block in your CSS? – epascarello Aug 15 '22 at 20:49
  • Do you have a repo I can clone? Alternatively, our error handling might be less than ideal for this case. You can go into `node_modules/preact-cli` and add a `console.log(info)` [after this line](https://github.com/preactjs/preact-cli/blob/6aba5d8e4c165c81f258ca9f367fea6c9a08cf17/packages/cli/lib/lib/webpack/run-webpack.js#L161). That might show a better error, or might not. Depends on where it's coming from. – rschristian Aug 17 '22 at 02:08

1 Answers1

0

Going after all '!' manually seems to be the only way I can think of right now!

  • So manually going for it was the only way. The issue was in Style folder, If you are facing same issue comment your css/styl files and check if your build is going forward without it. – Vishalpatra Aug 18 '22 at 14:22
  • Your answer could be improved with additional supporting information. Please [edit] to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers [in the help center](/help/how-to-answer). – Community Aug 19 '22 at 09:10