Skip to content

Remove the need for both preval & codegen #2

@jesstelford

Description

@jesstelford

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>)

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions