mirror of
https://github.com/psychopy/psychojs.git
synced 2025-05-10 10:40:54 +00:00
scripts/js: add an iife outfile with PsychoJS global
This commit is contained in:
parent
d495dd95fa
commit
3fe9c9cb2c
@ -5,14 +5,27 @@ const versionMaybe = process.env.npm_config_outver;
|
||||
const dirMaybe = process.env.npm_config_outdir;
|
||||
const [,,, dir = dirMaybe || 'out', version = versionMaybe || pkg.version] = process.argv;
|
||||
|
||||
buildSync({
|
||||
[
|
||||
// The ESM bundle
|
||||
{
|
||||
format: 'esm',
|
||||
legalComments: 'external',
|
||||
outfile: `./${dir}/psychojs-${version}.js`,
|
||||
},
|
||||
// The IIFE
|
||||
{
|
||||
globalName: 'PsychoJS',
|
||||
legalComments: 'none',
|
||||
outfile: `./${dir}/psychojs-${version}.iife.js`
|
||||
}
|
||||
].forEach(function build(options) {
|
||||
buildSync({ ...this, ...options });
|
||||
}, {
|
||||
// Shared options
|
||||
banner: {
|
||||
js: `/*! For license information please see psychojs-${version}.js.LEGAL.txt */`,
|
||||
},
|
||||
bundle: true,
|
||||
entryPoints: ['src/index.js'],
|
||||
format: 'esm',
|
||||
legalComments: 'external',
|
||||
minify: true,
|
||||
outfile: `./${dir}/psychojs-${version}.js`
|
||||
minify: true
|
||||
});
|
||||
|
Loading…
Reference in New Issue
Block a user