From e3d233db96c4beb3496f7b1f4efebb24af03ac5d Mon Sep 17 00:00:00 2001 From: Carlos Precioso Date: Sun, 22 Dec 2019 14:04:54 +0100 Subject: [PATCH] Update references to rollup-plugin-json --- docs/04-tutorial.md | 10 +++++----- src/Module.ts | 2 +- test/function/samples/error-parse-json/_config.js | 2 +- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/docs/04-tutorial.md b/docs/04-tutorial.md index ec4061266d8..34febe4b35d 100755 --- a/docs/04-tutorial.md +++ b/docs/04-tutorial.md @@ -173,7 +173,7 @@ So far, we've created a simple bundle from an entry point and a module imported For that, we use *plugins*, which change the behaviour of Rollup at key points in the bundling process. A list of awesome plugins is maintained on [the Rollup Awesome List](https://github.com/rollup/awesome). -For this tutorial, we'll use [rollup-plugin-json](https://github.com/rollup/rollup-plugin-json), which allows Rollup to import data from a JSON file. +For this tutorial, we'll use [@rollup/plugin-json](https://github.com/rollup/plugins/tree/master/packages/json), which allows Rollup to import data from a JSON file. Create a file in the project root called `package.json`, and add the following content: @@ -187,10 +187,10 @@ Create a file in the project root called `package.json`, and add the following c } ``` -Install rollup-plugin-json as a development dependency: +Install @rollup/plugin-json as a development dependency: ``` -npm install --save-dev rollup-plugin-json +npm install --save-dev @rollup/plugin-json ``` (We're using `--save-dev` rather than `--save` because our code doesn't actually depend on the plugin when it runs – only when we're building the bundle.) @@ -210,7 +210,7 @@ Edit your `rollup.config.js` file to include the JSON plugin: ```js // rollup.config.js -import json from 'rollup-plugin-json'; +import json from '@rollup/plugin-json'; export default { input: 'src/main.js', @@ -252,7 +252,7 @@ Edit your `rollup.config.js` file to add a second minified output. As format, we ```js // rollup.config.js -import json from 'rollup-plugin-json'; +import json from '@rollup/plugin-json'; import {terser} from 'rollup-plugin-terser'; export default { diff --git a/src/Module.ts b/src/Module.ts index 6124b2dce5d..bf8b3531edc 100644 --- a/src/Module.ts +++ b/src/Module.ts @@ -131,7 +131,7 @@ function tryParse(module: Module, Parser: typeof acorn.Parser, acornOptions: aco } catch (err) { let message = err.message.replace(/ \(\d+:\d+\)$/, ''); if (module.id.endsWith('.json')) { - message += ' (Note that you need rollup-plugin-json to import JSON files)'; + message += ' (Note that you need @rollup/plugin-json to import JSON files)'; } else if (!module.id.endsWith('.js')) { message += ' (Note that you need plugins to import files that are not JavaScript)'; } diff --git a/test/function/samples/error-parse-json/_config.js b/test/function/samples/error-parse-json/_config.js index e9a3c2fe6a6..62dbc19fa45 100644 --- a/test/function/samples/error-parse-json/_config.js +++ b/test/function/samples/error-parse-json/_config.js @@ -5,7 +5,7 @@ module.exports = { 'throws with an extended error message when failing to parse a file with ".json" extension', error: { code: 'PARSE_ERROR', - message: 'Unexpected token (Note that you need rollup-plugin-json to import JSON files)', + message: 'Unexpected token (Note that you need @rollup/plugin-json to import JSON files)', parserError: { loc: { column: 8,