Skip to content
This repository has been archived by the owner on Dec 30, 2021. It is now read-only.

redundant files in build directory after bundling #127

Open
danprince opened this issue Jun 11, 2020 · 2 comments
Open

redundant files in build directory after bundling #127

danprince opened this issue Jun 11, 2020 · 2 comments
Labels
help wanted Extra attention is needed

Comments

@danprince
Copy link

It looks like the bundling step from @snowpack/plugin-parcel doesn't do any kind of cleanup after bundling, so the build directory ends up containing the bundled/fingerprinted assets and the original output from snowpack build.

I think it'd make more sense to file this issue wherever that plugin code lives, but I can't find the repo!

{
  "scripts": {
    "mount:public": "mount public --to /",
    "mount:src": "mount src --to /_dist_"
  },
  "plugins": [
    "@snowpack/plugin-parcel"
  ]
}

Produces something like:

src/
  index.js      # original source
build/
  web_modules/
  _dist_/
    index.js           # this is the index.js with rewritten web_modules paths
  _dist_.a45130ae.js   # this is the bundled file

After bundling, I want to deploy the build dir, but I don't really want to deploy build/web_modules or build/_dist_ because they aren't going to be used.

Ideally the bundling plugins would output the bundled version to a separate directory (I think Parcel already does this with a .build directory) then clean build and copy the contents across.

@FredKSchott
Copy link
Owner

No worries, moving to the proper repo

@FredKSchott FredKSchott transferred this issue from FredKSchott/snowpack Jun 11, 2020
@FredKSchott
Copy link
Owner

FredKSchott commented Jun 11, 2020

Yup, this is expected behavior for now (there's no way right now to tell what was and wasn't bundled after the bundler ran, so we default to include everything).

We should add a feature to the plugin to analyze which files were included in the final bundle, and delete them from the build directory. I think that there are straightforward Webpack hooks that we can hook into for this, but I'm not sure about Parcel.

@FredKSchott FredKSchott added the help wanted Extra attention is needed label Jun 11, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

2 participants