-
Notifications
You must be signed in to change notification settings - Fork 126
Description
Unable to run repo on a Windows or other OS.
Use Case for Proposal
I recently ran into an issue i wanted to take time to debug because i really wanted to use jodit in my Next.js project and i wanted to check if the demo could reproduce the same issue outside of Next or if it would be easier to debug with the repo locally - so this is why this is a problem if the repo cannot be run in different environments. These fixes allowed me to run and find the issue and open PR for it as well as these build fixes.
Opening this issue to link to PR.
The PR fixes 3 issues listed below with desscriptions of the type of errors they throw in another environment i.e. Windows
These issues prevent the contributor or user from running any of these scripts (or the demo ones but thats split out to a different PR)
npm run build
npm run build:types
npm run remove-css
- Using
NODE_ENVinstead ofcross-env NODE_ENVis OS incompatible. cross-env makes it OS compatible which is good for a project that benefits from many contributors
$ npm run build
jodit-react@5.0.13 build
npm run build:react && npm run build:typesjodit-react@5.0.13 build:react
NODE_ENV=production node -r @swc-node/register ./node_modules/.bin/webpack --mode production'NODE_ENV' is not recognized as an internal or external command,
operable program or batch file.
- Running
npm run build:typesbroken
Threw an error due to issue withremove-css- this is a simple fix in package.json
Also could not build due to"skipLibCheck": truemissing in tsconfig.types.json - threw errors about every .d.ts file, recommended to set to true so will be able to run build
jodit-react@5.0.13 remove-css
replace "import '[^']+.css';" '' ./build/**/*.tsnode:fs:1633
const stats = binding.lstat(
^Error: ENOENT: no such file or directory, lstat 'C:\Users\user\jodit-react\build**.ts'
at Object.lstatSync (node:fs:1633:25)
at replacizeFileSync (C:\Users\user\jodit-react\node_modules\replace\replace.js:140:22)
at module.exports (C:\Users\user\jodit-react\node_modules\replace\replace.js:80:17)
at Object. (C:\Users\user\jodit-react\node_modules\replace\bin\replace.js:42:1)
at Module._compile (node:internal/modules/cjs/loader:1358:14)
at Module._extensions..js (node:internal/modules/cjs/loader:1416:10)
at Module.load (node:internal/modules/cjs/loader:1208:32)
at Module._load (node:internal/modules/cjs/loader:1024:12)
at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:174:12)
at node:internal/main/run_main_module:28:49 {
errno: -4058,
code: 'ENOENT',
syscall: 'lstat',
path: 'C:\Users\user\jodit-react\build\**\.ts'
}
- Running
npm run buildbroken (below)
This is what happens when using this./node_modules/.bin/webpackin Windows env (below)
Fixed by updating webpack.config to .js and package.json (adding webpack script that allows webpack to run correctly in any environment)
This allowsnpm run build:typesandnpm run buildruns successfully.
$ npm run build
jodit-react@5.0.13 build
npm run build:react && npm run build:typesjodit-react@5.0.13 build:react
cross-env NODE_ENV=production node -r @swc-node/register ./node_modules/.bin/webpack --mode productionC:\Users\user\jodit-react\node_modules.bin\webpack:2
basedir=$(dirname "$(echo "$0" | sed -e 's,\,/,g')")
^^^^^^^SyntaxError: missing ) after argument list
at wrapSafe (node:internal/modules/cjs/loader:1281:20)
at Module._compile (node:internal/modules/cjs/loader:1321:27)
at Module._extensions..js (node:internal/modules/cjs/loader:1416:10)
at Object.newLoader [as .js] (C:\Users\user\jodit-react\node_modules\pirates\lib\index.js:121:7)
at Module.load (node:internal/modules/cjs/loader:1208:32)
at Function.Module._load (node:internal/modules/cjs/loader:1024:12)
at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:174:12)
at node:internal/main/run_main_module:28:49Node.js v20.13.1