question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Parcel development server using programmatic API works on v1.x but not on v2.x

See original GitHub issue

🐛 bug report

Parcel development server using programmatic API works on v1.x but not on v2.x

🎛 Configuration (.babelrc, package.json, cli command)

No .babelrc

No CLI command

package.json :

{
  "dependencies": {
    "@parcel/config-default": "^2.0.0-alpha.3",
    "@parcel/core": "^2.0.0-alpha.3",
    "vue": "^2.6.11"
  }
}

🤔 Expected Behavior

The development server should run properly in v2.x just like in v1.x

😯 Current Behavior

The development server doesn’t run properly in v2.x just like in v1.x

Here is the output :

Server running at http://localhost:5492
√ Built in 7.01s.
× console: (node:7944) UnhandledPromiseRejectionWarning: AssertionError [ERRASSERTION]: The expression evaluated to a falsy value:

  (0, assert.default)(server != null)

    at Object.report (D:\Documents\GitHub\vue-parcel\nodemodules\@parcel\reporter-dev-server\lib\ServerReporter.js:70:29)
    at ReporterRunner.report (D:\Documents\GitHub\vue-parcel\nodemodules\@parcel\core\lib\ReporterRunner.js:69:31)
    at process.tickCallback (internal/process/nexttick.js:68:7)
× console: (node:7944) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 2)
× console: (node:7944) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

💁 Possible Solution

The problem seem related to that file : https://github.com/parcel-bundler/parcel/blob/v2/packages/reporters/dev-server/src/ServerReporter.js

🔦 Context

I’m trying to create a Vue.JS project in the most basic way possible.

I chose Parcel as bundler because it truly works with zero-config, and fastly.

My real configuration is inside an Electron instance but I promise this is absolutely irrelevant, proof with what follows.

💻 Code Sample

You can find a full demonstration on this repository : https://github.com/KaKi87/vue-parcel

Please look at the parcel-v1 branch to see the working example then look at the parcel-v2 branch wich is a port of the v1.x configuration for v2.x, nothing less, nothing more, but which doesn’t work.

🌍 Your Environment

Software Version(s)
Parcel 2.0.0 alpha 3
Node 10.16
Yarn 1.16
Operating System Win10 19041.1

I pledge to become a backer if I succeed publishing my project using Parcel v2.x within next week. My project used to work in Parcel v1.x except zero-config support for async/await, which, from what I’ve been told, works in v2.x, implying that it’s a wontfix for 1.x

Thanks

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:12 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
Xiphecommented, Feb 6, 2020

disableCache and serve.host can also be omitted.

The only thing irritating here (in my opinion) is that the default config does not know its location. I may open a PR for that 😃

import Parcel from '@parcel/core';
import defaultConfig from '@parcel/config-default';
import getPort from 'get-port';

await new Parcel({
  entries: [path.join(__dirname, './index.html')],
  defaultConfig: {
    ...defaultConfig,
    filePath: require.resolve('@parcel/config-default'),
  },
  serve: {
    port: await getPort(),
  },
}).watch();
1reaction
DeMoorJaspercommented, Feb 6, 2020

The API is only meant for advanced usage like mentioned you should use the cli for normal usage and yes vue isn’t supported but we have a seperate dedicated issue tracking that.

We’re always open to an RFC on how we could improve the API as I also mentioned

Read more comments on GitHub >

github_iconTop Results From Across the Web

Development - Parcel
Parcel automatically tracks all of the files, configuration, plugins, and dev dependencies that are involved in your build, and granularly invalidates the cache ......
Read more >
Just-in-Time Mode - Tailwind CSS
Lightning fast build times. Tailwind can take 3–8s to initially compile using our CLI, and upwards of 30–45s in webpack projects because webpack...
Read more >
Nightwatch Settings | Developer Guide
Reference to list of settings received by nightwatch instance during test execution.
Read more >
Content Management API | Contentful
The only entity which always uses generated sys.id values is spaces . Note: sys metadata fields can not be changed programmatically. The sys.id...
Read more >
API design: Which version of versioning is right for you?
With all this information, who's an API developer to believe? Here on the Apigee team at Google Cloud, we design, use and see...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found