Export * syntax not supported
See original GitHub issueWhen trying to use bokehjs together with npm and create-react-app the compiler gives an error. This can be easily reproduced by building the following dockerfile and running it after
FROM node:12
WORKDIR /usr/src/app
RUN npx create-react-app bokehbug --template typescript
WORKDIR /usr/src/app/bokehbug/src
RUN wget https://gist.githubusercontent.com/bsdis/415a77d017c32d2678cefd9a0a23fb22/raw/83a7a91fb82420a550b8ad66f8001034fc1dab69/App.tsx -O App.tsx
WORKDIR /usr/src/app/bokehbug
RUN wget https://gist.githubusercontent.com/bsdis/415a77d017c32d2678cefd9a0a23fb22/raw/83a7a91fb82420a550b8ad66f8001034fc1dab69/package.json -O package.json
RUN npm install
CMD npm start
Build this dockerfile by first installing docker and then use docker build -t bbug … To see the error after building, run:
docker run -it --name bokehbug -p 3000:3000 bbug bash
and when in the container run
npm start
The observed error is:
zuifrontend_1 | Failed to compile.
zuifrontend_1 |
zuifrontend_1 | ./node_modules/@bokeh/bokehjs/build/js/lib/index.js 3:9
zuifrontend_1 | Module parse failed: Unexpected token (3:9)
zuifrontend_1 | File was processed with these loaders:
zuifrontend_1 | * ./node_modules/babel-loader/lib/index.js
zuifrontend_1 | You may need an additional loader to handle the result of these loaders.
zuifrontend_1 | | export { version } from "./version";
zuifrontend_1 | | export { index } from "./embed";
zuifrontend_1 | > export * as embed from "./embed";
zuifrontend_1 | | export * as protocol from "./protocol";
zuifrontend_1 | | export * as _testing from "./testing";
The problem is not with node (12.x or whichever), because bokehjs is not a node library, but it’s web browser library. So bokehjs’ code is not run in node at any point in time, it’s just being processed by node libraries like babel-loader, which apparently doesn’t recognize this pretty new ES export star syntax. Is it possible to upgrade the babel library in CRA so that it can support libraries in node_modules that uses this export * syntax?
Issue Analytics
- State:
- Created 3 years ago
- Reactions:2
- Comments:8 (2 by maintainers)
Top GitHub Comments
FYI, we enabled support for parsing
export * as ns from "foo"
by default to @babel/parser (in #10521) but not to @babel/preset-env.We’ll have a fix for this shortly, feel free to follow: https://github.com/babel/babel/issues/11363
This issue has been automatically closed because it has not had any recent activity. If you have a question or comment, please open a new issue.