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

Remove the need for both preval & codegen #2

Open
jesstelford opened this issue Dec 22, 2021 · 0 comments
Open

Remove the need for both preval & codegen #2

jesstelford opened this issue Dec 22, 2021 · 0 comments
Labels
enhancement New feature or request

Comments

@jesstelford
Copy link
Collaborator

jesstelford commented Dec 22, 2021

The babel implementation currently requires both babel-plugin-codegen & babel-plugin-preval leading to a verbose 2-line format:

const filename = preval`module.exports = __filename`;
const Layout = codegen.require("@ceteio/next-layout-loader", filename);

Is there a way to remove the need for preval?

When I try to add __filename directly as the second parameter to codegen.require, I get an error:

const Layout = codegen.require("@ceteio/next-layout-loader", __filename);
Error: codegen cannot determine the value of an argument in codegen.require
    at Array.map (<anonymous>)
@jesstelford jesstelford added the enhancement New feature or request label Dec 22, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant