StevieB
StevieB

Reputation: 6523

VS Code Dynamic Import syntax error statement expected

Any idea how to get rid of this warning in VS Code

  const loadAnalytics = () => {
    import(
      /* webpackChunkName: "chunk-analytics" */ './analytics'
    ).then(page => page.init());
  };

enter image description here

"Declaration or Statement expected", the code actually compiles file just annoying to keep seeing this warning in VS code.

Upvotes: 2

Views: 756

Answers (1)

Matt Bierner
Matt Bierner

Reputation: 65175

Update - November 3, 2017

VS Code 1.14+ fully supports import expressions. You should no longer run into this issue


Original Answer

Import expressions are not supported in VSCode 1.13 but we just added support for them in VScode 1.14. You can try this today in the current insiders builds

If need to stay on 1.13, @Steffen's suggestion about setting "javascript.validate.enable": false is the way to go

Upvotes: 4

Related Questions