mirror of
https://github.com/jspsych/jsPsych.git
synced 2025-05-10 11:10:54 +00:00
Replace @rollup/plugin-json
with esbuild's json
loader
This commit is contained in:
parent
1375339f63
commit
6d0689decb
20
package-lock.json
generated
20
package-lock.json
generated
@ -3169,25 +3169,6 @@
|
||||
"node": ">=10"
|
||||
}
|
||||
},
|
||||
"node_modules/@rollup/plugin-json": {
|
||||
"version": "5.0.1",
|
||||
"resolved": "https://registry.npmjs.org/@rollup/plugin-json/-/plugin-json-5.0.1.tgz",
|
||||
"integrity": "sha512-QCwhZZLvM8nRcTHyR1vOgyTMiAnjiNj1ebD/BMRvbO1oc/z14lZH6PfxXeegee2B6mky/u9fia4fxRM4TqrUaw==",
|
||||
"dependencies": {
|
||||
"@rollup/pluginutils": "^5.0.1"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=14.0.0"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"rollup": "^1.20.0||^2.0.0||^3.0.0"
|
||||
},
|
||||
"peerDependenciesMeta": {
|
||||
"rollup": {
|
||||
"optional": true
|
||||
}
|
||||
}
|
||||
},
|
||||
"node_modules/@rollup/plugin-node-resolve": {
|
||||
"version": "15.0.1",
|
||||
"resolved": "https://registry.npmjs.org/@rollup/plugin-node-resolve/-/plugin-node-resolve-15.0.1.tgz",
|
||||
@ -17369,7 +17350,6 @@
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@rollup/plugin-commonjs": "23.0.2",
|
||||
"@rollup/plugin-json": "5.0.1",
|
||||
"@rollup/plugin-node-resolve": "15.0.1",
|
||||
"@sucrase/jest-plugin": "3.0.0",
|
||||
"@types/gulp": "4.0.10",
|
||||
|
@ -37,7 +37,6 @@
|
||||
"homepage": "https://www.jspsych.org/latest/developers/configuration",
|
||||
"dependencies": {
|
||||
"@rollup/plugin-commonjs": "23.0.2",
|
||||
"@rollup/plugin-json": "5.0.1",
|
||||
"@rollup/plugin-node-resolve": "15.0.1",
|
||||
"@sucrase/jest-plugin": "3.0.0",
|
||||
"@types/gulp": "4.0.10",
|
||||
|
@ -2,7 +2,6 @@ import { readFileSync } from "fs";
|
||||
import path from "path";
|
||||
|
||||
import commonjs from "@rollup/plugin-commonjs";
|
||||
import json from "@rollup/plugin-json";
|
||||
import resolve from "@rollup/plugin-node-resolve";
|
||||
import { defineConfig } from "rollup";
|
||||
import dts from "rollup-plugin-dts";
|
||||
@ -39,6 +38,16 @@ const makeConfig = ({
|
||||
...outputOptions,
|
||||
};
|
||||
|
||||
/** @type{import("rollup-plugin-esbuild").Options} */
|
||||
const esBuildPluginOptions = {
|
||||
loaders: { ".json": "json" },
|
||||
};
|
||||
|
||||
/** @type{import("@rollup/plugin-commonjs").RollupCommonJSOptions} */
|
||||
const commonjsPluginOptions = {
|
||||
extensions: [".js", ".json"],
|
||||
};
|
||||
|
||||
// Non-babel builds
|
||||
const config = defineConfig([
|
||||
// Type definitions (bundled as a single .d.ts file)
|
||||
@ -60,7 +69,11 @@ const makeConfig = ({
|
||||
{
|
||||
...globalOptions,
|
||||
input,
|
||||
plugins: [externals(), json(), esbuild({ target: "node14" }), commonjs()],
|
||||
plugins: [
|
||||
externals(),
|
||||
esbuild({ ...esBuildPluginOptions, target: "node18" }),
|
||||
commonjs(commonjsPluginOptions),
|
||||
],
|
||||
output: [
|
||||
{ file: `${destination}.js`, format: "esm", ...outputOptions },
|
||||
{ file: `${destination}.cjs`, format: "cjs", ...outputOptions },
|
||||
@ -84,9 +97,8 @@ const makeConfig = ({
|
||||
plugins: [
|
||||
externals({ deps: false }),
|
||||
resolve({ preferBuiltins: false }),
|
||||
json(),
|
||||
esbuild({ target: "esnext" }),
|
||||
commonjs(),
|
||||
esbuild({ ...esBuildPluginOptions, target: "esnext" }),
|
||||
commonjs(commonjsPluginOptions),
|
||||
],
|
||||
output: {
|
||||
file: `${destination}.browser.js`,
|
||||
@ -104,9 +116,8 @@ const makeConfig = ({
|
||||
plugins: [
|
||||
externals({ deps: false }),
|
||||
resolve({ preferBuiltins: false }),
|
||||
json(),
|
||||
esbuild({ target: "es2015", minify: true }),
|
||||
commonjs(),
|
||||
esbuild({ ...esBuildPluginOptions, target: "es2015", minify: true }),
|
||||
commonjs(commonjsPluginOptions),
|
||||
],
|
||||
output: {
|
||||
file: `${destination}.browser.min.js`,
|
||||
|
Loading…
Reference in New Issue
Block a user