You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
npm i
npm run build
npm prune --production
npm start
Error message after npm start
Error: Cannot find module 'tslib'
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:636:15)
at Function.Module._load (internal/modules/cjs/loader.js:562:25)
at Module.require (internal/modules/cjs/loader.js:690:17)
at require (internal/modules/cjs/helpers.js:25:18)
at Object.<anonymous> (XXXXXXX/node_modules/used-styles/dist/es5/scanForStyles.js:3:15)
at Module._compile (internal/modules/cjs/loader.js:776:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:787:10)
at Module.load (internal/modules/cjs/loader.js:653:32)
at tryModuleLoad (internal/modules/cjs/loader.js:593:12)
at Function.Module._load (internal/modules/cjs/loader.js:585:3)
The file containing the error: ....node_modules/used-styles/dist/es5/scanForStyles.js:3:15)
"use strict";Object.defineProperty(exports,"__esModule",{value: true});vartslib_1=require("tslib");// <--- this lib is not listed as prod or peer dependency so it's crashingvarfs_1=require("fs");// .... etc
import{discoverProjectStyles,getUsedStyles}from'used-styles'constprojectStyles=discoverProjectStyles(`${__dirname}/../client`)exportdefault(req: Request,res: Response)=>{// ...//some code above constusedStyles=getUsedStyles(markup,projectStyles)console.log('used styles',usedStyles)// and some code after ...}
I'm facing this error in production build:
build pipeline:
Error message after
npm start
The file containing the error:
....node_modules/used-styles/dist/es5/scanForStyles.js:3:15)
package.json snippet:
usage:
middleware.tsx
tsconfig.json
The text was updated successfully, but these errors were encountered: