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

Error when importing into project #108

Closed
therebelrobot opened this issue Oct 12, 2020 · 3 comments
Closed

Error when importing into project #108

therebelrobot opened this issue Oct 12, 2020 · 3 comments
Labels
bug Something isn't working

Comments

@therebelrobot
Copy link

Reproduction Steps

  • install and import into a project that:
    • uses babel
    • doesn't compile node_modules folder
      • i don't think this is standard in cjs projects to compile anything in node_modules, it generally accepted that modules should work without additional developer steps

Error:

import React, { useState, useEffect } from "react";
^^^^^^

SyntaxError: Cannot use import statement outside a module
    at wrapSafe (internal/modules/cjs/loader.js:1167:16)
    at Module._compile (internal/modules/cjs/loader.js:1215:27)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1272:10)
    at Module.load (internal/modules/cjs/loader.js:1100:32)
    at Function.Module._load (internal/modules/cjs/loader.js:962:14)
    at Module.require (internal/modules/cjs/loader.js:1140:19)
    at require (internal/modules/cjs/helpers.js:75:18)
    at eval (webpack-internal:///recoilize:1:18)
    at Object.recoilize ([REDACTED]/.next/server/pages/_app.js:441:1)
    at __webpack_require__ ([REDACTED]/.next/server/pages/_app.js:23:31)

I'd be happy to open a PR fixing the build to make it usable in common js projects, or maybe so it can be used by both mjs and cjs?

@jonescamilla jonescamilla added the bug Something isn't working label Oct 12, 2020
@bentron2000
Copy link

Also having this issue

@nbargers
Copy link
Contributor

Issue fixed with Recoilize Version 2.0.1

@m-sterspace
Copy link

m-sterspace commented Sep 30, 2021

I'm still getting this with 2.0.1 and next.js, in dev mode at least.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

6 participants