Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Missing ts-loader breaks npm run dll:build #143

Closed
lamuertepeluda opened this issue Mar 30, 2023 · 1 comment · Fixed by #146
Closed

Missing ts-loader breaks npm run dll:build #143

lamuertepeluda opened this issue Mar 30, 2023 · 1 comment · Fixed by #146
Assignees
Labels
squad:devops Issue to be handled by the Devops team. type:bug This issue reports a buggy (incorrect) behavior.
Milestone

Comments

@lamuertepeluda
Copy link

Hello there,

this generator breaks as soon as I tried to generate a ts package.

I also had to export NODE_OPTIONS=--openssl-legacy-provider as suggested here to make it start, which surprised me given this closed issue, but then it broke because ts-loader is missing. I noticed that it is in the generated lock file but not in the generate package.json

After npm i -D ts-loader the npm run dll:build works.

📝 Provide detailed reproduction steps (if any)

npx ckeditor5-package-generator @mytest/ckeditor5-a-package --use-npm --lang ts --verbose

✔️ Expected result

Webpack compiles correctly

❌ Actual result

npx ckeditor5-package-generator @mytest/ckeditor5-a-package --use-npm --lang ts --verbose
📍 Verifying the specified package name.
📍 Checking whether the "ckeditor5-a-package" directory can be created.
📍 Creating the directory "/Users/mac-user/Development/ckeditor/ckeditor5-a-package".
📍 Collecting the latest CKEditor 5 packages versions...
📍 Copying files...
* Copying "common/.editorconfig"...
* Copying "common/.stylelintrc"...
* Copying "common/ckeditor5-metadata.json"...
* Copying "common/lang/contexts.json"...
* Copying "common/LICENSE.md"...
* Copying "common/README.md"...
* Copying "common/theme/icons/ckeditor.svg"...
* Copying "ts/.eslintrc.js"...
* Copying "ts/.gitattributes"...
* Copying "ts/.gitignore.txt"...
* Copying "ts/package.json"...
* Copying "ts/sample/ckeditor.ts.txt"...
* Copying "ts/sample/dll.html.txt"...
* Copying "ts/sample/index.html"...
* Copying "ts/src/_PLACEHOLDER_.ts.txt"...
* Copying "ts/src/index.ts.txt"...
* Copying "ts/tests/_PLACEHOLDER_.ts.txt"...
* Copying "ts/tests/index.ts.txt"...
* Copying "ts/tsconfig.json.txt"...
* Copying "ts/tsconfig.release.json"...
* Copying "ts/typings/ckeditor5-inspector.d.ts"...
* Copying "ts/typings/types.d.ts.txt"...
📍 Installing dependencies... It takes a while.
npm WARN deprecated @npmcli/move-file@1.1.2: This functionality has been moved to @npmcli/fs
npm WARN deprecated source-map-url@0.4.1: See https://github.com/lydell/source-map-url#deprecated
npm WARN deprecated stable@0.1.8: Modern JS already guarantees Array#sort() is a stable sort, so this library is deprecated. See the compatibility table on MDN: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/sort#browser_compatibility
npm WARN deprecated @stylelint/postcss-markdown@0.36.2: Use the original unforked package instead: postcss-markdown
npm WARN deprecated urix@0.1.0: Please see https://github.com/lydell/urix#deprecated
npm WARN deprecated fsevents@2.1.3: "Please update to latest v2.3 or v2.2"
npm WARN deprecated resolve-url@0.2.1: https://github.com/lydell/resolve-url#deprecated
npm WARN deprecated source-map-resolve@0.5.3: See https://github.com/lydell/source-map-resolve#deprecated
npm WARN deprecated debug@3.2.6: Debug versions >=3.2.0 <3.2.7 || >=4 <4.3.1 have a low-severity ReDos regression when used in a Node.js environment. It is recommended you upgrade to 3.2.7 or 4.3.1. (https://github.com/visionmedia/debug/issues/797)
npm WARN deprecated fsevents@1.2.13: fsevents 1 will break on node v14+ and could be using insecure binaries. Upgrade to fsevents 2.
npm WARN deprecated chokidar@2.1.8: Chokidar 2 does not receive security updates since 2019. Upgrade to chokidar 3 with 15x fewer dependencies
npm WARN deprecated querystring@0.2.0: The querystring API is considered Legacy. new code should use the URLSearchParams API instead.
npm WARN deprecated @stylelint/postcss-css-in-js@0.37.3: Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.
npm WARN deprecated core-js@2.6.12: core-js@<3.23.3 is no longer maintained and not recommended for usage due to the number of issues. Because of the V8 engine whims, feature detection in old core-js versions could cause a slowdown up to 100x even if nothing is polyfilled. Some versions have web compatibility issues. Please, upgrade your dependencies to the actual version of core-js.

> @mytest/ckeditor5-a-package@0.0.1 prepare
> npm run dll:build


> @mytest/ckeditor5-a-package@0.0.1 dll:build
> ckeditor5-package-tools dll:build

(node:58963) [DEP_WEBPACK_MAIN_TEMPLATE_HASH_FOR_CHUNK] DeprecationWarning: MainTemplate.hooks.hashForChunk is deprecated (use JavascriptModulesPlugin.getCompilationHooks().chunkHash instead)
(Use `node --trace-deprecation ...` to show where the warning was created)
(node:58963) [DEP_WEBPACK_CHUNK_TEMPLATE_HASH_FOR_CHUNK] DeprecationWarning: ChunkTemplate.hooks.hashForChunk is deprecated (use JavascriptModulesPlugin.getCompilationHooks().chunkHash instead)
(node:58963) [DEP_WEBPACK_COMPILATION_OPTIMIZE_CHUNK_ASSETS] DeprecationWarning: optimizeChunkAssets is deprecated (use Compilation.hooks.processAssets instead and use one of Compilation.PROCESS_ASSETS_STAGE_* as stage option)
/Users/mac-user/Development/ckeditor/ckeditor5-a-package/node_modules/@ckeditor/ckeditor5-package-tools/lib/tasks/dll-build.js:27
				reject( new Error( stats.toString() ) );
				        ^

Error: assets by status 0 bytes [cached] 1 asset

ERROR in main
Module not found: Error: Can't resolve 'ts-loader' in '/Users/mac-user/Development/ckeditor/ckeditor5-a-package'
resolve 'ts-loader' in '/Users/mac-user/Development/ckeditor/ckeditor5-a-package'
  Parsed request is a module
  using description file: /Users/mac-user/Development/ckeditor/ckeditor5-a-package/package.json (relative path: .)
    resolve as module
      looking for modules in /Users/mac-user/Development/ckeditor/ckeditor5-a-package/node_modules
        single file module
          using description file: /Users/mac-user/Development/ckeditor/ckeditor5-a-package/package.json (relative path: ./node_modules/ts-loader)
            no extension
              /Users/mac-user/Development/ckeditor/ckeditor5-a-package/node_modules/ts-loader doesn't exist
            .js
              /Users/mac-user/Development/ckeditor/ckeditor5-a-package/node_modules/ts-loader.js doesn't exist
        /Users/mac-user/Development/ckeditor/ckeditor5-a-package/node_modules/ts-loader doesn't exist
      /Users/mac-user/Development/ckeditor/node_modules doesn't exist or is not a directory
      /Users/mac-user/Development/node_modules doesn't exist or is not a directory
      /Users/mac-user/Development/Websites/next-cms-context/node_modules doesn't exist or is not a directory
      /Users/mac-user/Development/Websites/node_modules doesn't exist or is not a directory
      /Users/mac-user/Development/node_modules doesn't exist or is not a directory
      /Users/mac-user/node_modules doesn't exist or is not a directory
      /Users/node_modules doesn't exist or is not a directory
      /node_modules doesn't exist or is not a directory

webpack 5.77.0 compiled with 1 error in 150 ms
    at /Users/mac-user/Development/ckeditor/ckeditor5-a-package/node_modules/@ckeditor/ckeditor5-package-tools/lib/tasks/dll-build.js:27:13
    at /Users/mac-user/Development/ckeditor/ckeditor5-a-package/node_modules/@ckeditor/ckeditor5-package-tools/node_modules/webpack/lib/webpack.js:148:8
    at /Users/mac-user/Development/ckeditor/ckeditor5-a-package/node_modules/@ckeditor/ckeditor5-package-tools/node_modules/webpack/lib/HookWebpackError.js:68:3
    at Hook.eval [as callAsync] (eval at create (/Users/mac-user/Development/ckeditor/ckeditor5-a-package/node_modules/@ckeditor/ckeditor5-package-tools/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:6:1)
    at Hook.CALL_ASYNC_DELEGATE [as _callAsync] (/Users/mac-user/Development/ckeditor/ckeditor5-a-package/node_modules/@ckeditor/ckeditor5-package-tools/node_modules/tapable/lib/Hook.js:18:14)
    at Cache.shutdown (/Users/mac-user/Development/ckeditor/ckeditor5-a-package/node_modules/@ckeditor/ckeditor5-package-tools/node_modules/webpack/lib/Cache.js:150:23)
    at /Users/mac-user/Development/ckeditor/ckeditor5-a-package/node_modules/@ckeditor/ckeditor5-package-tools/node_modules/webpack/lib/Compiler.js:1225:15
    at Hook.eval [as callAsync] (eval at create (/Users/mac-user/Development/ckeditor/ckeditor5-a-package/node_modules/@ckeditor/ckeditor5-package-tools/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:6:1)
    at Hook.CALL_ASYNC_DELEGATE [as _callAsync] (/Users/mac-user/Development/ckeditor/ckeditor5-a-package/node_modules/@ckeditor/ckeditor5-package-tools/node_modules/tapable/lib/Hook.js:18:14)
    at Compiler.close (/Users/mac-user/Development/ckeditor/ckeditor5-a-package/node_modules/@ckeditor/ckeditor5-package-tools/node_modules/webpack/lib/Compiler.js:1218:23)
    at /Users/mac-user/Development/ckeditor/ckeditor5-a-package/node_modules/@ckeditor/ckeditor5-package-tools/node_modules/webpack/lib/webpack.js:147:16
    at finalCallback (/Users/mac-user/Development/ckeditor/ckeditor5-a-package/node_modules/@ckeditor/ckeditor5-package-tools/node_modules/webpack/lib/Compiler.js:441:32)
    at /Users/mac-user/Development/ckeditor/ckeditor5-a-package/node_modules/@ckeditor/ckeditor5-package-tools/node_modules/webpack/lib/Compiler.js:458:13
    at Hook.eval [as callAsync] (eval at create (/Users/mac-user/Development/ckeditor/ckeditor5-a-package/node_modules/@ckeditor/ckeditor5-package-tools/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:6:1)
    at Hook.CALL_ASYNC_DELEGATE [as _callAsync] (/Users/mac-user/Development/ckeditor/ckeditor5-a-package/node_modules/@ckeditor/ckeditor5-package-tools/node_modules/tapable/lib/Hook.js:18:14)
    at onCompiled (/Users/mac-user/Development/ckeditor/ckeditor5-a-package/node_modules/@ckeditor/ckeditor5-package-tools/node_modules/webpack/lib/Compiler.js:456:21)

Node.js v18.12.1
npm ERR! code 1
npm ERR! path /Users/mac-user/Development/ckeditor/ckeditor5-a-package
npm ERR! command failed
npm ERR! command sh -c npm run dll:build

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/mac-user/.npm/_logs/2023-03-30T13_26_57_129Z-debug-0.log
/Users/mac-user/.npm/_npx/5166aebc640c7801/node_modules/ckeditor5-package-generator/lib/utils/install-dependencies.js:77
				return reject( new Error( 'Installing dependencies finished with an error.' ) );
				               ^

Error: Installing dependencies finished with an error.
    at ChildProcess.<anonymous> (/Users/mac-user/.npm/_npx/5166aebc640c7801/node_modules/ckeditor5-package-generator/lib/utils/install-dependencies.js:77:20)
    at ChildProcess.emit (node:events:513:28)
    at maybeClose (node:internal/child_process:1091:16)
    at ChildProcess._handle.onexit (node:internal/child_process:302:5)

Node.js v18.12.1

❓ Possible solution

  • include ts-loader in the dev dependencies of the generated process if needed by webpack
  • solve the annoying issue of "legacy provider" by prepending NODE_OPTIONS=--openssl-legacy-provider by default or make node 18 (current LTS) as default

📃 Other details

  • Node: 18.12.1
  • Npm: 9.5.1
  • First affected version: v1.0.0-beta.10 (didn't try older)

macOS 13.2.1 on M1 Pro

If you'd like to see this fixed sooner, add a 👍 reaction to this post.

@lamuertepeluda lamuertepeluda added the type:bug This issue reports a buggy (incorrect) behavior. label Mar 30, 2023
@pomek pomek added the squad:devops Issue to be handled by the Devops team. label Apr 7, 2023
@pomek
Copy link
Member

pomek commented Apr 12, 2023

Scope

  • Add ts-loader to pkg-utils
    "dependencies": {
    "@ckeditor/ckeditor5-dev-transifex": "^35.0.0",
    "@ckeditor/ckeditor5-dev-translations": "^35.0.0",
    "@ckeditor/ckeditor5-dev-utils": "^35.0.0",
    "buffer": "^6.0.3",
    "chai": "^4.3.4",
    "css-loader": "^5.2.7",
    "istanbul-instrumenter-loader": "^3.0.1",
    "karma": "^6.3.17",
    "karma-chai": "^0.1.0",
    "karma-chrome-launcher": "^3.1.0",
    "karma-coverage": "^2.0.3",
    "karma-mocha": "^2.0.1",
    "karma-mocha-reporter": "^2.2.5",
    "karma-sinon": "^1.0.5",
    "karma-sinon-chai": "^2.0.2",
    "karma-sourcemap-loader": "^0.3.8",
    "karma-webpack": "^5.0.0",
    "minimist": "^1.2.5",
    "mocha": "^7.2.0",
    "postcss": "^8.4.12",
    "postcss-loader": "^4.3.0",
    "process": "^0.11.10",
    "raw-loader": "^4.0.2",
    "sinon": "^9.2.4",
    "sinon-chai": "^3.7.0",
    "style-loader": "^2.0.0",
    "stylelint": "^13.13.1",
    "stylelint-config-ckeditor5": "^2.0.1",
    "terser-webpack-plugin": "^3.0.2",
    "ts-node": "^10.9.1",
    "typescript": "^4.7.4",
    "webpack": "^5.58.1",
    "webpack-dev-server": "^4.3.1"
    },
  • Add a new combination to CI test script: npm + ts. We already have yarn + ts, and npm + js. It makes sense to cover all combinations. Consider adding yarn + js too.

@CKEditorBot CKEditorBot added status:planned Set automatically when an issue lands in the "Sprint backlog" column. We will be working on it soon. status:in-progress Set automatically when an issue lands in the "In progress" column. We are working on it. and removed status:planned Set automatically when an issue lands in the "Sprint backlog" column. We will be working on it soon. labels Apr 12, 2023
@przemyslaw-zan przemyslaw-zan self-assigned this Apr 13, 2023
pomek added a commit that referenced this issue Apr 19, 2023
Fix (tools): Added the missing `ts-loader`. Webpack missed it when creating a new package using `npm` as the package manager. Closes #143.
@CKEditorBot CKEditorBot removed the status:in-progress Set automatically when an issue lands in the "In progress" column. We are working on it. label Apr 19, 2023
@CKEditorBot CKEditorBot added this to the iteration 63 milestone Apr 19, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
squad:devops Issue to be handled by the Devops team. type:bug This issue reports a buggy (incorrect) behavior.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants