From 7e9bd462f6a13b0c1f17cce4654d5dd2406a85c9 Mon Sep 17 00:00:00 2001 From: Mark Skelton Date: Thu, 25 Mar 2021 09:10:39 -0500 Subject: [PATCH] Add three example resolver --- scripts/rollup-example-resolver.js | 13 +++++++++++++ scripts/rollup.config.js | 4 +++- 2 files changed, 16 insertions(+), 1 deletion(-) create mode 100644 scripts/rollup-example-resolver.js diff --git a/scripts/rollup-example-resolver.js b/scripts/rollup-example-resolver.js new file mode 100644 index 00000000..54a1751c --- /dev/null +++ b/scripts/rollup-example-resolver.js @@ -0,0 +1,13 @@ +module.exports = { + name: 'example-resolver', + resolveId(source) { + if (source.startsWith('three/examples/js')) { + return { + id: require.resolve(source), + external: false + }; + } + + return null; + }, +} diff --git a/scripts/rollup.config.js b/scripts/rollup.config.js index b7b93118..7ea1e466 100644 --- a/scripts/rollup.config.js +++ b/scripts/rollup.config.js @@ -1,13 +1,15 @@ const generate = require('videojs-generate-rollup-config'); const replace = require('./rollup-replace'); +const exampleResolver = require('./rollup-example-resolver'); // see https://github.com/videojs/videojs-generate-rollup-config // for options const options = { primedPlugins(defaults) { - return Object.assign(defaults, {replace}); + return Object.assign(defaults, {exampleResolver,replace}); }, plugins(defaults) { + defaults.module.unshift('exampleResolver') // add replace just after json for each build Object.keys(defaults).forEach((type) => {