@rollup/plugin-json imported but doesn't work

@rollup/plugin-json imported but doesn't work

·

1 min read

I'd built my project within rollup.js .

Suddenly today when I started it terminal gave me this message:

(!) Plugin json: Could not parse JSON file
src\data.json
[!] Error: Unexpected character '�' (Note that you need @rollup/plugin-json to import JSON files)

In spite that I'd already had this plugin which Converts .json files to ES6 modules installed.

Then I also checked in rollup.config.js and there everything is correct:

  • it's in import:
import json from "@rollup/plugin-json";
  • and also in plugins:
plugins: [
    replace({
      "process.env.NODE_ENV": JSON.stringify("development"),
    }),
    resolve({
      browser: true,
    }),
    babel({
      presets: ["@babel/preset-react"],
      babelHelpers: "bundled",
    }),
    commonjs(),
    watch && serve("dist"),
    watch && livereload(),
    json(),
  ],

So now need to find out what to do with it?!