-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This commit will do two things. First, this will only bundle iife configs. Second, it adds the data package as an external dependency.
- Loading branch information
Showing
5 changed files
with
42 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,18 @@ | ||
import { makeRollupConfig } from "@jspsych/config/rollup"; | ||
import { nodeResolve } from "@rollup/plugin-node-resolve"; | ||
import dotenv from "rollup-plugin-dotenv"; | ||
import { makeRollupConfig } from "../../rollup.mjs"; | ||
|
||
const config = makeRollupConfig("chsData"); | ||
export const iifeNameData = "chsData"; | ||
|
||
config.map((c) => { | ||
c.plugins = [ | ||
nodeResolve({ | ||
browser: true, | ||
preferBuiltins: false, | ||
}), | ||
dotenv(), | ||
...c.plugins, | ||
]; | ||
export default makeRollupConfig(iifeNameData).map((config) => { | ||
return { | ||
...config, | ||
plugins: [ | ||
// Resolve node dependencies to be used in a browser. | ||
nodeResolve({ browser: true, preferBuiltins: false }), | ||
// Add support for .env files | ||
dotenv(), | ||
...config.plugins, | ||
], | ||
}; | ||
}); | ||
|
||
export default config; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
import { makeRollupConfig } from "@jspsych/config/rollup"; | ||
|
||
import { makeRollupConfig } from "../../rollup.mjs"; | ||
// This package name needs to be unique | ||
export default makeRollupConfig("chsInitJsPsych"); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
import { makeRollupConfig } from "@jspsych/config/rollup"; | ||
import { makeRollupConfig } from "../../rollup.mjs"; | ||
// This package name needs to be unique | ||
export default makeRollupConfig("chsRecord"); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
import { makeRollupConfig } from "@jspsych/config/rollup"; | ||
import { makeRollupConfig } from "../../rollup.mjs"; | ||
// This package name needs to be unique | ||
export default makeRollupConfig("chsSurvey"); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
import { makeRollupConfig as jsPsychMakeRollupConfig } from "@jspsych/config/rollup"; | ||
import { iifeNameData } from "./packages/data/rollup.config.mjs"; | ||
|
||
export function makeRollupConfig(iifeName) { | ||
return jsPsychMakeRollupConfig(iifeName).map((config) => { | ||
return { | ||
...config, | ||
// Add data package as external dependency | ||
external: [...config.external, "@lookit/data"], | ||
output: config.output | ||
// Only build iife bundles | ||
.filter((output) => output.format === "iife") | ||
.map((output) => { | ||
return { | ||
...output, | ||
globals: { | ||
...output.globals, | ||
// Explicitly state data's iife name | ||
"@lookit/data": iifeNameData, | ||
}, | ||
}; | ||
}), | ||
}; | ||
}); | ||
} |