Skip to content

customizeTheme with files that use JS throws error SyntaxError: Cannot use import statement outside a module #52

@HernanFaifman

Description

@HernanFaifman

I have a couple of files that set up the theme and style variables for my App. I have them each in their own file and I import one another using the import syntax. I keep getting this compilation error when using customizeTheme and starting the App:

eg: let´s assume it says  import fontSize from "./fontSize"
SyntaxError: Cannot use import statement outside a module

The config is as follows:

const CracoAntDesignPlugin = require("craco-antd");
const { customVariables } = require("./src/styles/styles");

module.exports = {
    plugins: [
        {
            plugin: CracoAntDesignPlugin,
            options: {
                customizeTheme: {
                customVariables,
                },
                javascriptEnabled: true,
            },
        },
    ],
};

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions