Svelte Webpack Boilerplate
This setup uses webpack
to bundle code
and Svelte to create
the user interface. This looks for files under
/src
and saves the compiled and minified
javascript code in /public/js
.
Install the required Node modules:
npm install svelte svelte-loader
.
const path = require('path');
.exports = {
moduleentry: {
dashboard: './src/dashboard.js',
account: './src/account.js',
,
}output: {
path: path.resolve(__dirname, 'public/js/'),
filename: "[name].js"
,
}mode: "production",
module: {
rules: [
{test: /\.(html|svelte)$/,
exclude: /node_modules/,
use: {
loader: 'svelte-loader',
options: {}
,
}
}
],
}plugins: [],
resolve: {
alias: {
svelte: path.resolve('node_modules', 'svelte')
,
}extensions: ['.mjs', '.js', '.svelte'],
mainFields: ['svelte', 'browser', 'module', 'main']
}; }