Parcel: 馃檵 Add https support in development server

Created on 19 Dec 2017  路  3Comments  路  Source: parcel-bundler/parcel

Would love to have https support in my local development.

webpack-dev-server supports it via the "--https" flag. all the self-signing ca/key stuff is happening behind the scenes.

I did some digging into the webpack-server-code and think we could even shamelessly copy most of the necessary code over to parcel.

Would you consider this as a PR?

Most helpful comment

For folks coming here via search: https://parceljs.org/cli.html#enable-https

Enable https

Default: https disabled

Available in: serve, watch (listen on HTTPS for HMR connections)

parcel build entry.js --https

鈿狅笍 This flag generates a self-signed certificate, you might have to configure your browser to allow self-signed certificates for localhost.

All 3 comments

No need to copy webpack code this has already been done and is currently in a PR #161

For folks coming here via search: https://parceljs.org/cli.html#enable-https

Enable https

Default: https disabled

Available in: serve, watch (listen on HTTPS for HMR connections)

parcel build entry.js --https

鈿狅笍 This flag generates a self-signed certificate, you might have to configure your browser to allow self-signed certificates for localhost.

still need to add localhost to the altName array, as by default --open flag opens the development preview at https://localhost:1234 and chrome flags this as insecure.

Suggested fix in the parcel/src/utils/generateCertificate.js:

altNames: [
        {
          type: 6, // URI
          value: 'http://example.org/webid#me'
        },
        {
          type: 7, // IP
          ip: '127.0.0.1'
        },
        {
          type: 8,
          value: `localhost`
        }
      ]
Was this page helpful?
0 / 5 - 0 ratings

Related issues

davidnagli picture davidnagli  路  3Comments

urbanhop picture urbanhop  路  3Comments

dsky1990 picture dsky1990  路  3Comments

devongovett picture devongovett  路  3Comments

Niggler picture Niggler  路  3Comments