Skip to content

Commit

Permalink
fix: include edited three.js examples in module dist files (#238)
Browse files Browse the repository at this point in the history
  • Loading branch information
mskelton authored Jun 14, 2021
1 parent 643dead commit 93bec48
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
13 changes: 13 additions & 0 deletions scripts/rollup-example-resolver.js
Original file line number Diff line number Diff line change
@@ -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;
},
}
4 changes: 3 additions & 1 deletion scripts/rollup.config.js
Original file line number Diff line number Diff line change
@@ -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) => {
Expand Down

0 comments on commit 93bec48

Please sign in to comment.