Svelte Native Preprocessor
A preprocessor for Svelte-Native.
It performs the following transforms to provide a better developer experience when using Svelte-Native:
- Adds
<svelte:options namespace="xmlns" />
to the component, ensuring the generated code is compatible with svelte-native - Changes
bind:text="{email}"
totext="{email}" on:textChanged="{e => email = e.value}"
Installation
Using svelte-loader, in webpack.config.js
const svelteNativePreprocessor = require("./svelte-native-preprocessor");
and where the svelte-loader
is registered add it to the options:
{
test: /\.svelte$/,
exclude: /node_modules/,
use: [
{
loader: 'svelte-loader',
options: {
preprocess: svelteNativePreprocessor()
}
}
]
},
There is a similar process for rollup-plugin-svelte
, but users of that library are usually skilled enough to work it out ;)
License
MIT.