Questions tagged [parceljs]

Blazing fast, zero configuration web application bundler

Official website

https://parceljs.org/

407 questions
4
votes
2 answers

How do I use service workers in parcel?

I have a service worker that comes from my js/index.js: import '../scss/app.scss'; // Detect if service workers enabled if ('serviceWorker' in navigator) { try { navigator.serviceWorker.register('../sw.js'); console.log('Service Worker…
fifn2
  • 314
  • 4
  • 13
4
votes
0 answers

Dynamic Import array of classes

I would like to dynamically load some components and am getting an error when executing the import() function. The import fails because it cannot find the file. Does anyone know how I can do this in ParcelJS? Error: Uncaught (in promise)…
Drew
  • 41
  • 1
4
votes
1 answer

@font-face not working after installing ParcelJS

I previously setup Gulp to use Sass, Pug and Babel. The fonts loaded fine. I switched to using Parcel now and it's working as expected, except one thing. The fonts arent loading in. Here is the entirety of _fonts.sass: @font-face font-family:…
Ibrahim
  • 328
  • 3
  • 12
3
votes
1 answer

parcel serve returns index.html for SourceMap requests and non existent urls

Plain vanilla typescript dev environment set up with parcel. I don't have SourceMap in browser (Edge/Chrome): DevTools failed to load SourceMap: Could not parse content for http://localhost:1234/index.7cacc1f4.js.map: Unexpected token < in JSON at…
szerte
  • 365
  • 1
  • 2
  • 11
3
votes
1 answer

ParcelJS bundling error - favicon.ico: Invalid Version: undefined

This is the first time I am using ParcelJS. I npm it following their instruction everything looks good. So it would be the latest version. As soon as I run it against my project (a .html file with some js and css attached to it), I get this…
Tom
  • 14,222
  • 12
  • 61
  • 105
3
votes
0 answers

How to insert scss inside shadowRoot Web Components

Is there an easy way to insert my scss file into my template.innerHTML? The purpose being encapsulation of this specific style to be effective only for this component. I am using "parcel-bundler": "^1.12.4" How can I import the scss without it…
Lynn
  • 99
  • 1
  • 15
3
votes
0 answers

How to "browserify" a node.js module into a browser importable ES6 module?

I first thought this would be trivial, but after digging into it, I can't find a way to do this. Is this impossible? For example, I would like to take any node.js package and compile it like this: import { method } from "SomeLibrary"; export const…
Vlad
  • 7,419
  • 11
  • 51
  • 82
3
votes
2 answers

How to serve a json file with parcel without bundling it?

I'm making a project with parcel and typescript. It works great, but for one library I'm using, I would need to host a bunch of .json-files at a fixed directory: The files look as following: index.html index.ts tiles/ | file.json | file0.json |…
Pieter
  • 709
  • 4
  • 16
3
votes
1 answer

Is it possible to decorate parcel bundler dist folder?

When I compile code with parcel using the command parcel src/index.html its just generate all files inside dist folder, like this image below. But I need a decorated way to manage files after complete my website. I mean I need img folder for all the…
Md Alex
  • 65
  • 4
3
votes
1 answer

Avoid JS variable renaming in HTML files on ParcelJS

I am using ParcelJS as a module bundler and for some reasons I am using JS variables in the HTML which are later to be read by JS code. In my HTML: In my…
jorditarrida
  • 63
  • 10
3
votes
2 answers

Parcel JS. Use of --public-url option

I am using Parcel JS for a personal project and I am really confused by this option: --public-url Here is the documentation: https://en.parceljs.org/cli.html#options which is really scarce. 1) What is the main use of it? 2) It says that it is…
jet2016
  • 127
  • 9
3
votes
1 answer

Parcel + SASS: Import from node_modules without tilde operator? Or is it something else?

I am using Parcel with SASS, and I am trying to use the material-components-web (MDC Web). In the guide of MDC Web they say you should import the modules that come with this package like this inside your stylesheets: @import…
user3517228
  • 101
  • 1
  • 2
3
votes
1 answer

How to use import with absolute paths in Cypress tests built with ParcelJS?

I'm using imports with absolute paths in my Parcel project but these absolute paths aren't equally resolved by Cypress tests. Difference in module resolution Parcel: import {foo} from '/foo.js': relatively to project root Cypress: import {foo} from…
Petr K.
  • 230
  • 2
  • 10
3
votes
3 answers

Parcel: configured port 1234 could not be used

I need to run my ReactJS application on the port 1234 but when I run yarn dev, I get the following: $ parcel src/index.html --port 1234 Server running at http://localhost:2493 - configured port 1234 could not be used. √ Built in 11.45s. It…
J86
  • 11,751
  • 29
  • 115
  • 194
3
votes
0 answers

Possible to bundle remote assets with ParcelJS

Is it possible to bundle external resources linked with absolute URLs to the dist folder with Parcel? This bundles and hashes fine to What i'd like to do
benpalmer
  • 1,853
  • 3
  • 15
  • 21