Reputation: 105
I am trying to deploy a Svelte application that uses Snowpack as a build tool and Routify for handling routes on Netlify. When I run the build command locally, everything is ok, but on the Netlify instance, the .routify folder is not generated, so the routes can't be accessed in the App script. The configuration for the project is as follows:
The package.json is
{
"scripts": {
"start": "run-p routify snp",
"build": "run-s build:*",
"build:routify": "routify -b",
"build:snowpack": "snowpack build",
"test": "web-test-runner \"src/**/*.test.ts\"",
"routify": "routify",
"snp": "snowpack dev"
},
"dependencies": {
"@snowpack/plugin-run-script": "^2.3.0",
"postcss-import": "^14.0.2",
"svelte": "^3.37.0"
},
"devDependencies": {
"@roxi/routify": "^2.18.3",
"@snowpack/plugin-dotenv": "^2.2.0",
"@snowpack/plugin-postcss": "^1.4.3",
"@snowpack/plugin-svelte": "^3.6.1",
"@snowpack/plugin-typescript": "^1.2.1",
"@snowpack/web-test-runner-plugin": "^0.2.2",
"@testing-library/svelte": "^3.0.3",
"@tsconfig/svelte": "^1.0.10",
"@types/chai": "^4.2.17",
"@types/mocha": "^8.2.2",
"@types/snowpack-env": "^2.3.3",
"@web/test-runner": "^0.13.3",
"autoprefixer": "^10.4.0",
"chai": "^4.3.4",
"concurrently": "^6.4.0",
"cross-env": "^7.0.3",
"npm-run-all": "^4.1.5",
"postcss": "^8.3.11",
"postcss-cli": "^9.0.2",
"postcss-load-config": "^3.1.0",
"snowpack": "^3.8.7",
"svelte-preprocess": "^4.7.2",
"tailwindcss": "^2.2.19",
"typescript": "^4.3.4"
},
"routify": {
"extensions": "svelte,html,svx,md",
"dynamicImports": false,
"routifyDir": "src/.routify"
}
}
and snowpack.config.js is
/** @type {import("snowpack").SnowpackUserConfig } */
module.exports = {
mount: {
public: { url: "/", static: true },
src: { url: "/dist" },
'.routify': { url: '/dist/.routify' },
},
plugins: [
"@snowpack/plugin-svelte",
"@snowpack/plugin-dotenv",
"@snowpack/plugin-typescript",
"@snowpack/plugin-postcss",
],
routes: [
/* Enable an SPA Fallback in development: */
{ match: "routes", src: ".*", dest: "/index.html" },
],
optimize: {
/* Example: Bundle your final build: */
// "bundle": true,
},
packageOptions: {
knownEntrypoints: ["@roxi/routify/runtime/buildRoutes"],
},
devOptions: {
/* ... */
},
buildOptions: {
/* ... */
},
};
Is there a problem with routify or is it something in my configuration that is missing?
Upvotes: 1
Views: 382