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

Module parse failed: Unexpected token #11284

Open
eward957 opened this issue Aug 5, 2021 · 6 comments
Open

Module parse failed: Unexpected token #11284

eward957 opened this issue Aug 5, 2021 · 6 comments

Comments

@eward957
Copy link

eward957 commented Aug 5, 2021

Describe the bug

Module parse failed: Unexpected token (3:55)
File was processed with these loaders:
 * ./node_modules/babel-loader/lib/index.js
You may need an additional loader to handle the result of these loaders.
import _regeneratorRuntime from"/data_b/work/gitlab-runner/builds/622b053b/0/lala/test/node_modules/babel-preset-react-app/node_modules/@babel/runtime/regenerator";import _objectSpread from"/data_b/work/gitlab-runner/builds/622b053b/...

occur a fatal error when building production version, but development correctly; :( ...

it seems to generated code of babel has error, between 'from' and '"/data_b/work/gitlab-runn' in error message haven't blank????

@eward957
Copy link
Author

eward957 commented Aug 5, 2021

yarn.lock indicate two @babel/core package was installed, @7.12.3 and @7.15.0

image

image
????

@eward957
Copy link
Author

eward957 commented Aug 5, 2021

temporal solution

i try to change babel's compact option to false, this error disappear.....

https://github.com/facebook/create-react-app/blob/main/packages/react-scripts/config/webpack.config.js#L438

@tep-pl
Copy link

tep-pl commented Aug 5, 2021

+1. we're facing the same issue for few hours as well, effectively getting CI builds blocked

@tep-pl
Copy link

tep-pl commented Aug 5, 2021

in our case the problem seems to be the following code:

const SomeContext = React.createContext(null);

export const SomeContextProvider = ({ children }) => {
    ...
    return (
        <SomeContext.Provider value={value}>
            {children}
        </SomeContext.Provider>
    );
};

getting transpiled to something like:
.... var SomeContext=/*#__PURE__*/React.createContext(null);SomeContext.displayName="SomeContext"export var SomeContextProvider=function SomeContextProvider(_ref) ....

note the missing semicolon between SomeContext.displayName="SomeContext" and export var SomeContextProvider

@eward957 eward957 closed this as completed Aug 8, 2021
@eward957 eward957 reopened this Aug 8, 2021
@eward957
Copy link
Author

eward957 commented Aug 8, 2021

+1. we're facing the same issue for few hours as well, effectively getting CI builds blocked

I guess: some denpendencies are incompatible with babel/core@7.15.0, but i don't know which one...

so, I upgrede all babel's plugins and presets, ci building working correctly now :(.

@stale
Copy link

stale bot commented Jan 9, 2022

This issue has been automatically marked as stale because it has not had any recent activity. It will be closed in 5 days if no further activity occurs.

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

No branches or pull requests

2 participants