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

Support for the experimental syntax 'dynamicImport' isn't currently enabled #987

Closed
stereobooster opened this issue May 15, 2018 · 12 comments
Closed
Labels

Comments

@stereobooster
Copy link

@stereobooster stereobooster commented May 15, 2018

Current behavior

styleguidist server
./node_modules/react-styleguidist/lib/rsg-components/Editor/EditorLoader.js
Syntax error: async-precious/node_modules/react-styleguidist/lib/rsg-components/Editor/EditorLoader.js: Support for the experimental syntax 'dynamicImport' isn't currently enabled (36:4):

  34 | 			var _this2 = this;
  35 |
> 36 | 			import('rsg-components/Editor/Editor').then(function (module) {
     | 			^
  37 | 				_this2.setState({ editor: module.default });
  38 | 			});
  39 | 		}

Add @babel/plugin-syntax-dynamic-import (https://git.io/vb4Sv) to the 'plugins' section of your Babel config to enable parsing.
	from thread-loader (worker 0)

To reproduce

git clone https://github.com/stereobooster/async-precious.git
cd async-precious
git checkout styleguidist-bug
yarn
yarn styleguide

Demo is not based on template, but I guess this doesn't matter because issue is with react-scripts@next.

Issue happens with react-scripts@2.0.0-next.b2fd8db8 and react-styleguidist@7.0.14.

But not with react-scripts@2.0.0-next.b2fd8db8 and react-styleguidist@6.5.3.

Expected behavior

No error

@sapegin

This comment has been minimized.

Copy link
Member

@sapegin sapegin commented May 16, 2018

I'm wondering why are they enabling Babel inside node_modules.

@stereobooster

This comment has been minimized.

Copy link
Author

@stereobooster stereobooster commented May 16, 2018

Here is proposal for it facebook/create-react-app#3776

@sapegin

This comment has been minimized.

Copy link
Member

@sapegin sapegin commented May 16, 2018

I think we should open an issue there, because they say “Verify this doesn't break third-party code” — but it breaks ;-) And they don't have to compile imports, just allow the syntax. Would you mind opening an issue at create-react-app?

@stereobooster

This comment has been minimized.

Copy link
Author

@stereobooster stereobooster commented May 16, 2018

Yes will open. Thanks for the tip

@jmlivingston

This comment has been minimized.

Copy link

@jmlivingston jmlivingston commented May 16, 2018

For what it's worth, I was able to successfully get this running by installing plugin-syntax-dynamic-import then add a .babelrc using create-react-app and react-scripts version 1.1.4. I'm sure mileage will vary.

npm install @babel/plugin-syntax-dynamic-import

.babelrc

{
  "plugins": ["@babel/plugin-syntax-dynamic-import"]
}
@stereobooster

This comment has been minimized.

Copy link
Author

@stereobooster stereobooster commented May 17, 2018

create-react-app bug report confirmed. Will close this

UPD: it is confirmed by not maintainer (facepalm). Why would you write "bug confirmed", if you are not maintainer, but whatever

@jmlivingston

This comment has been minimized.

Copy link

@jmlivingston jmlivingston commented May 17, 2018

Yeah, probably should have made that more clear. Maybe "successfully duplicated" would have been more clear? 🤷‍♂️

@stereobooster

This comment has been minimized.

Copy link
Author

@stereobooster stereobooster commented May 18, 2018

@sapegin can you please take a part in the discussion in create-react-app 🙌. They try to understand if it is easier drop dynamic import in styleguidist or allow it in node_modules. facebook/create-react-app#3776

Thanks

@stereobooster stereobooster reopened this May 18, 2018
@sapegin

This comment has been minimized.

Copy link
Member

@sapegin sapegin commented May 18, 2018

I don't see any discussion there, is that the right link?

@stereobooster

This comment has been minimized.

Copy link
Author

@stereobooster stereobooster commented May 18, 2018

@sapegin

This comment has been minimized.

Copy link
Member

@sapegin sapegin commented Jul 19, 2018

This may be a good solution for that: #1054.

sapegin added a commit that referenced this issue Aug 5, 2018
BREAKING CHANGE:

* editorConfig option is no longer available
* Remove code splitting and Bable dynamic import plugins

Closes #987 #1054
sapegin added a commit that referenced this issue Aug 6, 2018
BREAKING CHANGE:

* editorConfig option is no longer available
* Remove code splitting and Bable dynamic import plugins

Closes #987 #1054
@sapegin sapegin added this to the 8.0.0: New editor milestone Aug 7, 2018
@sapegin sapegin removed this from the 9.0.0: New editor milestone Nov 3, 2018
@sapegin

This comment has been minimized.

Copy link
Member

@sapegin sapegin commented Nov 3, 2018

This was fixed on CRA side, closing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants
You can’t perform that action at this time.