0

I'm running npx snowpack build --watch in a project (not the dev command due to a Flask backend), and am having some problems with internal imports.

By that I mean modules importing dependencies - so Bootstrap importing Popper for example.

The problem is that the build works if I build regularly (without the --watch command), but it takes 20-30 seconds each time, a bit annoying for development. If I run with the --watch command, any of the npm modules that import another module have incorrect file paths e.g.:

import * as Popper from '/_snowpack/pkg/@popperjs.core.v2.9.3.js';

If I change them to this:

import * as Popper from '../../_snowpack/pkg/@popperjs.core.v2.9.3.js';

It works fine. All the other imports have the correct paths. The problem is every time the watch server switches off, I have to run the find/replace. This currently amounts to only a few of the modules, and it's better than running a full build, but it'd be nice if I could get this to work, and hopefully understand Snowpack a bit better in the process.

I'm running the most recent version of Snowpack installed from npm, on default settings.

I don't have an awful lot of experience with Snowpack or this kind of software, so fully acknowledge this could be user error. I have played around a bit with the mount and build options, but nothing seems to change this path issue.

jt196
  • 17
  • 5

1 Answers1

0

Seems like this is a Snowpack version issue. As per this comment, I downgraded to v 2.10.1 and the imports work fine now without me having to rename them. Phew!

jt196
  • 17
  • 5