SerkanSipahi / babel-plugin-app-decorators-script-module

babel plugin that generate fallback (old browser) case <script type="module" src=".." main="..". />
0 stars 0 forks source link

babel plugin that generate fallback case <script type="module" src=".." main="..". /> #1

Open SerkanSipahi opened 7 years ago

SerkanSipahi commented 7 years ago

Suggestion

in:

<!doctype html>
<meta charset=utf-8>
<script type="module" src="main.js"></script>

out (compiled code):

<!doctype html>
<meta charset=utf-8>
<script type="module" src="modules-bootstrap.js" main="dist-esm/main.js"></script>
<script defer src="modules-bootstrap.js" main="dist-system/main.js" systemjs="/node_modules/systemjs/dist/system-production.js"></script>

.babelrc

{
        plugins: [
            ['app-decorators-script-module', {
                "pattern": [
                        'src/to/some.html',
                        'src/to/**/*.html',
                         //...,
                         //....,
                ],
                "systemjs": '/node_modules/systemjs/dist/system-production.js',
                "dist": [
                     { esm: 'path/to/esm' },
                     { system: 'path/to/system' },
                 ]
            }]
        ]
}

How to?

Why with a babel-plugin?