supront-plugin-js
v0.0.3
Published
> It is built into supront by default.
Downloads
11
Readme
supront-plugin-js
It is built into supront by default.
HTML javascript source bundler (using esbuild)
const supront = require('supront');
const { javascriptPlugin } = require('supront-plugin-js');
const code = `
<script src="index.js"></script>
`;
const dist = supront.bundle(code, {
plugins: [javascriptPlugin({ base: __dirname })],
base: __dirname,
});
// index.js
require('helloworld.js')();
// helloworld.js
console.log('hello, world');
⚠️ Warning
bad :
<script>
require('helloworld.js')(); // not working!!
</script>
good :
<script src="..." />