in progress
This commit is contained in:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user