1

Building a React NextJS and rollup bumps into the following error:

rollup.config.js:

import json from '@rollup/plugin-json';
import typescript from '@rollup/plugin-typescript';
import ts from "rollup-plugin-ts";
import jsx from 'acorn-jsx';
import tsConfig from './tsconfig.json';
const config = [
    {
        input: "index.ts",
        output: [{ file: "build/index.js", sourcemap: true }],
        acornInjectPlugins: [jsx()],
        plugins: [
            typescript(
                {
                    sourceMap: tsConfig.compilerOptions.sourceMap
                }
            ),
            json()
        ]
    },
    {
        input: "index.ts",
        output: [{ file: "build/index.d.ts", "format": "es" }],
        acornInjectPlugins: [jsx()],
        plugins: [
            ts(
                {
                    compilerOptions: {
                        baseUrl: tsConfig.compilerOptions.baseUrl
                    }
                }
            ),
            json()
        ]
    },
]

export default config;
2: import clsx from "clsx";
3: import { sortBy } from "lodash";
4: import { DragDropContext, Draggable, Droppable } from "react-beautiful-dnd";
            ^
5: import { Direction } from "react-beautiful-dnd/src/types";
6: import makeStyles from "@mui/styles/makeStyles";
...and 2 other occurrences
[!] (plugin Typescript) TS8006: 'import type' declarations can only be used in TypeScript files.
node_modules/react-beautiful-dnd/src/types.js (2:1)

2 import type { BoxModel, Rect, Position } from 'css-box-model';
  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Kok How Teh
  • 3,298
  • 6
  • 47
  • 85

1 Answers1

3

in VSCode:

  1. Make sure you have the extension Flow Language Support installed.

    • Go to extensions
    • Type: Flow Language Support
    • Install the Flow Language Support extension
  2. Go to extensions and disable TypeScript and JavaScript Language

    • Go to extensions
    • Type: @builtin TypeScript and JavaScript Language Features
    • Disable the extension
    • Click on Reload Required
J.G.
  • 91
  • 5