Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Snowpack 3.8 cannot find the source folder, running dev server with different root directory

I have a project structure like this:

enter image description here

When starting the dev server from root directory everything works perfectly. I would like my index.html file to be in the src directory, but then snowpack does not find the index.html file. When starting the snowpack dev server from inside the src directory it says it can not find the package.json file which is required.

Is there a possibility to start the snowpack dev server from my projects directory, but point to src as the root directory to be served?

I have tried the following configurations in snowpack.config.js

export default {
  root: "./src/index.html",
  mount: {
    src: "/src",
    public: "/",
  },
};
export default {
  mount: {
    public: { url: '/', static: true },
    src: { url: '/src' },
  },
};
export default {
  mount: {
    public: '/',
    src: '/src',
  },
};
like image 465
VINIT CHURI Avatar asked Apr 21 '26 05:04

VINIT CHURI


1 Answers

If someone swing by having a similar problem, this link might help:

frontend build config generator

The generator created the following snowpack.config:

{
  "mount": {
    "dist": "/",
    "src": "/"
  }
}

After applying this configuration, Snowpack should work as requested.

like image 103
D. Herzog Avatar answered Apr 23 '26 19:04

D. Herzog



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!