geovistory / design-system

MIT License
2 stars 1 forks source link

refactor dev mode #65

Closed joschne closed 1 year ago

joschne commented 1 year ago

This PR refactors the dev mode in order to speed up the hot module reload (HMR) time.

It does so by adding two changes:

This PR is linked to #62 and #63 in the sense as they are also about HMR time.

Steps to see effect

In order to see the HRM time, do:

On my computer the change is loaded to the browser after 1 sec.

flicksolutions commented 1 year ago

The build is failing when I run npm run dev with the following output:

[ ERROR ]  TypeScript: ./src/components/geov-class-distri/test/geov-class-distri.spec.tsx:3:32
           Cannot find module '../../../../hydrate/index' or its corresponding type declarations.

      L2:  import { newSpecPage } from '@stencil/core/testing';
      L3:  import { renderToString } from '../../../../hydrate/index';
      L4:  import { GeovClassDistri } from '../geov-class-distri';

[ ERROR ]  TypeScript: ./src/components/geov-entity-label/test/geov-entity-label.spec.tsx:3:32
           Cannot find module '../../../../hydrate/index' or its corresponding type declarations.

      L2:  import { mockFetch, newSpecPage } from '@stencil/core/testing';
      L3:  import { renderToString } from '../../../../hydrate/index';
      L4:  import { SparqlBinding } from '../../../components';

[21:50.8]  build failed, watching for changes... in 1.22 s

happens after complete reinstall too.

flicksolutions commented 1 year ago

unfortunately, i found another problem: when I try to run storybook either through npm run dev:storybook or npm run dev:docs I get the following error:

node:internal/crypto/hash:69
  this[kHandle] = new _Hash(algorithm, xofLen);
                  ^

    at F:\Documents\3_Repositories\design-system\packages\design-system-web\node_modules\webpack\lib\NormalModule.js:503:5
    at F:\Documents\3_Repositories\design-system\packages\design-system-web\node_modules\webpack\lib\NormalModule.js:358:12
    at F:\Documents\3_Repositories\design-system\packages\design-system-web\node_modules\loader-runner\lib\LoaderRunner.js:373:3
    at iterateNormalLoaders (F:\Documents\3_Repositories\design-system\packages\design-system-web\node_modules\loader-runner\lib\LoaderRunner.js:214:10)    
    at F:\Documents\3_Repositories\design-system\packages\design-system-web\node_modules\loader-runner\lib\LoaderRunner.js:205:4 {
  opensslErrorStack: [ 'error:03000086:digital envelope routines::initialization error' ],
  library: 'digital envelope routines',
  reason: 'unsupported',
  code: 'ERR_OSSL_EVP_UNSUPPORTED'
}

Is storybook broken?

joschne commented 1 year ago

I think we can use this branch / PR to make the full integration of storybook 7 based on web components.

We will then have to review again.