in progress

This commit is contained in:
jfh
2020-08-20 14:31:19 +02:00
parent a5fa39a3d4
commit 2e2e86641d
8 changed files with 55536 additions and 7 deletions

View File

@@ -9,7 +9,7 @@ import nodePolyfills from 'rollup-plugin-node-polyfills';
// eslint-disable-next-line no-console
rimraf('./dist', () => console.info('recreating dist'));
const config = {
const config = [{
input: 'src/editor/index.js',
preserveEntrySignatures: false,
output: [
@@ -20,6 +20,13 @@ const config = {
sourcemap: true
// dir: 'dist/editor'
},
{
format: 'system',
file: 'dist/editor/index-system.js',
inlineDynamicImports: true,
sourcemap: true
// dir: 'dist/editor'
},
{
format: 'iife',
file: 'dist/editor/index-iife.js',
@@ -45,6 +52,26 @@ const config = {
transform: (contents) => contents.toString()
.replace('<script type="module" src="index.js">', '<script defer="defer" src="index-iife.js">')
},
{
src: 'src/editor/index.html',
dest: 'dist/editor',
rename: 'index-system.html',
transform: (contents) => contents.toString()
.replace('<script type="module" src="index.js">',
`<script>
if (!window.supportsDynamicImport) {
const systemJsLoaderTag = document.createElement('script');
systemJsLoaderTag.src = './s.min.js';
systemJsLoaderTag.addEventListener('load', function () {
System.import('./index-system.js');
});
document.head.appendChild(systemJsLoaderTag);
}`)
},
{
src: ['node_modules/systemjs/dist/s.min.js', 'node_modules/systemjs/dist/s.min.js.map'],
dest: 'dist/editor'
},
{
src: 'src/editor/index.html',
dest: 'dist/editor',
@@ -69,14 +96,14 @@ const config = {
{src: 'src/editor/svgedit.css', dest: 'dist/editor'}
]
}),
commonjs(),
babel({babelHelpers: 'bundled'}),
nodePolyfills(),
nodeResolve({
browser: true,
preferBuiltins: true
})
}),
commonjs(),
babel({babelHelpers: 'bundled'}),
nodePolyfills()
]
};
}];
export default config;