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

Breaking change in micromatch 4 in ts-loader 5.4.6 #929

Closed
pvtri96 opened this issue May 6, 2019 · 13 comments
Closed

Breaking change in micromatch 4 in ts-loader 5.4.6 #929

pvtri96 opened this issue May 6, 2019 · 13 comments

Comments

@pvtri96
Copy link

pvtri96 commented May 6, 2019

Expected Behaviour

Everything should work fine because it is just a patch, not a breaking release.

Actual Behaviour

I am having this log when trying to upgrade to version 5.4.6

[root]\node_modules\ts-loader\node_modules\micromatch\index.js:44
    let isMatch = picomatch(String(patterns[i]), { ...options, onResult }, true);
                                                   ^^^

SyntaxError: Unexpected token ...

Steps to Reproduce the Problem

Here is my webpack.config.js

const TsconfigPathsPlugin = require('tsconfig-paths-webpack-plugin');

module.exports = {
  resolve: {
    extensions: ['.ts', '.js'],
    plugins: [new TsconfigPathsPlugin({})],
  },
  module: {
    rules: [
      {
        test: /\.ts$/,
        exclude: [/node_modules/],
        use: [
          {
            loader: 'ts-loader',
          },
        ],
      },
    ],
  },
};

Location of a Minimal Repository that Demonstrates the Issue.

Refer to this PR: penta-jelly/re-radio#167

Follow these steps will produce this error

  • Checkout branch.
  • Run cd e2e
  • Run npm ci
  • Run npm run cypress:open
  • Open any test showing up in Cypress panel.
  • Then you can see the error log described above.

CI build result: https://circleci.com/gh/penta-jelly/re-radio/802

@johnnyreilly
Copy link
Member

johnnyreilly commented May 6, 2019

what version of node are you running?

I've unpublished 5.4.6 - it looks like node 8 is the minimum requirement and that doesn't appear to be listed in the breaking changes: https://github.com/micromatch/micromatch/blob/bdd32f41e07f401b12ae7c8b04d22b275c88c84b/package.json#L33

Will update ts-loader to 6.0.0 and republish with the appropriate node version range

@johnnyreilly
Copy link
Member

See #930 for progress

@pvtri96
Copy link
Author

pvtri96 commented May 6, 2019

@johnnyreilly I am using node 10. Release this dependencies upgrade on version on 6.0 is fine for me, I will figure a way to solve it on my project.

@johnnyreilly
Copy link
Member

johnnyreilly commented May 6, 2019

Okay that's somewhat unexpected - according to micromatch the minimum is node 8. So I'm not clear why it's failing on your project.... The error message suggests that it's the { ...options that's problematic. This suggests you're running on pre node 8.6 (see https://medium.com/@adambrodziak/use-js-object-spread-operator-instead-of-object-assign-pattern-in-node-8-125a4914f6dd )

Am I right? Can you think of another reason why this would be an issue for you?

@pvtri96
Copy link
Author

pvtri96 commented May 6, 2019

I am thinking the reason it is failed because ts-loader was ran directly on Browser (Cypress mechanism) but not on NodeJS environment. Do you have any idea about how to solve it?

@johnnyreilly
Copy link
Member

I am thinking the reason it is failed because ts-loader was ran directly on Browser

I'm not sure I understand how that would work... Either way, I'd still expect object spread to be just fine since chrome has had it for a very long time indeed!

Puzzling...

@zoltanbedi
Copy link

@pvtri96 It is a problem in cypress not in ts-loader. Cypress comes with electron builtin with chorme 63 that does not support object spread. You should be fine after this cypress-io/cypress#4001 gets released. What you can do is to not run your code in electron but the browser instead. You can do it like this https://docs.cypress.io/guides/guides/command-line.html#cypress-run

@pvtri96
Copy link
Author

pvtri96 commented May 6, 2019

@B3zo0 thanks for your in-depth answer. Instead of trying to find a workaround for this, I am better stick with ts-loader@5.4.5 while waiting for Cypress to release the new version with Chrome 73 support.

@johnnyreilly
Copy link
Member

Re-released as 6.0.0 https://github.com/TypeStrong/ts-loader/releases/tag/v6.0.0

@vytautas-pranskunas-
Copy link

vytautas-pranskunas- commented May 14, 2019

any updates on this? because with v6.0.0 it has this problem.

@johnnyreilly
Copy link
Member

Without knowing your problem I can't advise in detail. Micromatch 4 is a breaking changes release and so (accordingly) ts-loader 6 is too. My advice is stick with 5.x until you're able to upgrade. That may mean waiting for a cypress release if that's what is impacting you.

@pvtri96
Copy link
Author

pvtri96 commented May 19, 2019

This issue should not be a problem since Cypress 3.3.0.

@anvlkv
Copy link

anvlkv commented Jun 20, 2019

Hi, i have this issue @6.0.3

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants