Security News
Cloudflare Adds Security.txt Setup Wizard
Cloudflare has launched a setup wizard allowing users to easily create and manage a security.txt file for vulnerability disclosure on their websites.
vue3-sfc-loader
Advanced tools
Vue3/Vue2 Single File Component loader.
Load .vue files dynamically at runtime from your html/js. No node.js environment, no (webpack) build step needed.
import()
)<html>
<body>
<div id="app"></div>
<script src="https://unpkg.com/vue@latest"></script>
<script src="https://cdn.jsdelivr.net/npm/vue3-sfc-loader/dist/vue3-sfc-loader.js"></script>
<script>
const options = {
moduleCache: {
vue: Vue
},
async getFile(url) {
const res = await fetch(url);
if ( !res.ok )
throw Object.assign(new Error(res.statusText + ' ' + url), { res });
return {
getContentData: asBinary => asBinary ? res.arrayBuffer() : res.text(),
}
},
addStyle(textContent) {
const style = Object.assign(document.createElement('style'), { textContent });
const ref = document.head.getElementsByTagName('style')[0] || null;
document.head.insertBefore(style, ref);
},
}
const { loadModule } = window['vue3-sfc-loader'];
const app = Vue.createApp({
components: {
'my-component': Vue.defineAsyncComponent( () => loadModule('./myComponent.vue', options) )
},
template: '<my-component></my-component>'
});
app.mount('#app');
</script>
</body>
</html>
see all examples
https://codepen.io/franckfreiburger/project/editor/AqPyBr
loadModule(path
: string, options
: Options): Promise<VueComponent>
npm install vue3-sfc-loader
esm version: dist/vue3-sfc-loader.esm.js
umd version: dist/vue3-sfc-loader.js
npm install vue3-sfc-loader
(use 'vue3-sfc-loader/dist/vue2-sfc-loader.js')esm version: dist/vue2-sfc-loader.esm.js
umd version: dist/vue2-sfc-loader.js
Example: enable IE11 support
npx webpack --config ./build/webpack.config.js --mode=production --env targetsBrowsers="> 1%, last 8 versions, Firefox ESR, not dead, IE 11"
check
see package.json
"build" script
see browserslist queries
preliminary steps:
vue3-sfc-loader
npm install --global yarn
)yarn install
vue3-sfc-loader.js
= Webpack
( @vue/compiler-sfc
+ @babel
)
.vue
file@vue/compiler-sfc
)@babel
)@babel/traverse
):speech_balloon: ask in Discussions tab
Many thanks to people that support this project !
FAQs
Single File Component loader
We found that vue3-sfc-loader demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Cloudflare has launched a setup wizard allowing users to easily create and manage a security.txt file for vulnerability disclosure on their websites.
Security News
The Socket Research team breaks down a malicious npm package targeting the legitimate DOMPurify library. It uses obfuscated code to hide that it is exfiltrating browser and crypto wallet data.
Security News
ENISA’s 2024 report highlights the EU’s top cybersecurity threats, including rising DDoS attacks, ransomware, supply chain vulnerabilities, and weaponized AI.