ember-fastboot / ember-cli-fastboot

Server-side rendering for Ember.js apps
http://ember-fastboot.com/
MIT License
851 stars 159 forks source link

Remove deprecated injections in Ember 4.x #900

Closed backspace closed 1 year ago

backspace commented 2 years ago

This is an attempt to fix #869. I don’t have much experience with addon development, but this seemed like a conventional way to check whether .inject could still be used.

Thanks for the years of work on this, all!

SergeAstapov commented 2 years ago

I think @mansona spend quite some time on these deprecation and has very good context here

gilest commented 2 years ago

Thanks for your contributions.

Tried installing from this branch and it broke the build.

Build Error (WaitForTrees)

The "path" argument must be of type string. Received undefined
  - broccoliBuilderErrorStack: TypeError [ERR_INVALID_ARG_TYPE]: The "path" argument must be of type string. Received undefined
    at new NodeError (node:internal/errors:387:5)
    at validateString (node:internal/validators:162:11)
    at join (node:path:1172:7)
    at CompatAddons.linkNonCopiedDeps (/application/node_modules/@embroider/compat/src/compat-addons.js:210:77)
    at CompatAddons.build (/application/node_modules/@embroider/compat/src/compat-addons.js:131:14)
    at WaitForTrees.build (/application/node_modules/@embroider/core/src/wait-for-trees.js:60:21)
    at TransformNodeWrapper.build (/application/node_modules/broccoli/dist/wrappers/transform-node.js:68:39)
    at /application/node_modules/broccoli/dist/builder.js:185:30
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
    at async Builder.build (/application/node_modules/broccoli/dist/builder.js:204:13)
  - code: [undefined]
  - codeFrame: The "path" argument must be of type string. Received undefined
  - errorMessage: The "path" argument must be of type string. Received undefined
        at WaitForTrees (@embroider/compat/addons)
-~- created here: -~-
    at new Plugin (/application/node_modules/@embroider/core/node_modules/broccoli-plugin/dist/index.js:47:36)
    at new WaitForTrees (/application/node_modules/@embroider/core/src/wait-for-trees.js:30:9)
    at CompatAddons.get tree [as tree] (/application/node_modules/@embroider/compat/src/compat-addons.js:56:16)
    at CompatApp.augment (/application/node_modules/@embroider/core/src/build-stage.js:53:64)
    at CompatApp.get tree (/application/node_modules/@embroider/core/src/build-stage.js:25:50)
    at CompatApp.<anonymous> (/application/node_modules/typescript-memoize/dist/memoize-decorator.js:132:52)
    at new PackagerRunner (/application/node_modules/@embroider/core/src/to-broccoli-plugin.js:11:26)
    at Object.defaultPipeline (/application/node_modules/@embroider/compat/src/default-pipeline.js:49:12)
    at module.exports (/application/ember-cli-build.js:111:39)
    at Builder.readBuildFile (/application/node_modules/ember-cli/lib/models/builder.js:49:14)
-~- (end) -~-
  - errorType: Build Error
  - location:
    - column: [undefined]
    - file: [undefined]
    - line: [undefined]
    - treeDir: [undefined]
  - message: The "path" argument must be of type string. Received undefined
        at WaitForTrees (@embroider/compat/addons)
-~- created here: -~-
    at new Plugin (/application/node_modules/@embroider/core/node_modules/broccoli-plugin/dist/index.js:47:36)
    at new WaitForTrees (/application/node_modules/@embroider/core/src/wait-for-trees.js:30:9)
    at CompatAddons.get tree [as tree] (/application/node_modules/@embroider/compat/src/compat-addons.js:56:16)
    at CompatApp.augment (/application/node_modules/@embroider/core/src/build-stage.js:53:64)
    at CompatApp.get tree (/application/node_modules/@embroider/core/src/build-stage.js:25:50)
    at CompatApp.<anonymous> (/application/node_modules/typescript-memoize/dist/memoize-decorator.js:132:52)
    at new PackagerRunner (/application/node_modules/@embroider/core/src/to-broccoli-plugin.js:11:26)
    at Object.defaultPipeline (/application/node_modules/@embroider/compat/src/default-pipeline.js:49:12)
    at module.exports (/application/ember-cli-build.js:111:39)
    at Builder.readBuildFile (/application/node_modules/ember-cli/lib/models/builder.js:49:14)
-~- (end) -~-
  - name: Error
  - nodeAnnotation: @embroider/compat/addons
  - nodeName: WaitForTrees
  - originalErrorMessage: The "path" argument must be of type string. Received undefined
  - stack: TypeError [ERR_INVALID_ARG_TYPE]: The "path" argument must be of type string. Received undefined
    at new NodeError (node:internal/errors:387:5)
    at validateString (node:internal/validators:162:11)
    at join (node:path:1172:7)
    at CompatAddons.linkNonCopiedDeps (/application/node_modules/@embroider/compat/src/compat-addons.js:210:77)
    at CompatAddons.build (/application/node_modules/@embroider/compat/src/compat-addons.js:131:14)
    at WaitForTrees.build (/application/node_modules/@embroider/core/src/wait-for-trees.js:60:21)
    at TransformNodeWrapper.build (/application/node_modules/broccoli/dist/wrappers/transform-node.js:68:39)
    at /application/node_modules/broccoli/dist/builder.js:185:30
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
    at async Builder.build (/application/node_modules/broccoli/dist/builder.js:204:13)
mikrostew commented 1 year ago

@gilest are you using Node 16? I ran into that same error in #902, and fixed it by updating workerpool in the lock file.

gilest commented 1 year ago

@mikrostew yes I am using node 16 – thanks for pointing that out 😄

ef4 commented 1 year ago

Thanks everyone, this work landed in #904.