You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* chore: fix `dendron-plugin-views` build
This aim of this commit is to fix the build task within `dendron-plugin-views` package which currently results into the following error:
```
/home/nam/code/dendronhq/dendron/node_modules/zod-validation-error/node_modules/@swc/helpers/src/index.mjs
Can't reexport the named export '__decorate' from non EcmaScript module (only default export is available)
```
The commit 419dec7 (PR: #3762) is responsible for this by adding a dependency
which conflicts with the webpack build in `dendron-plugin-views`. That
dependency uses withing its cjs build files `@swc/helpers` which
conflicts with the import type from webpack.
The solution is to use explicitly set [`Rule.type`](https://webpack.js.org/configuration/module/#ruletype) property which was introduced in [webpack 4.0](https://github.com/webpack/webpack/releases/tag/v4.0.0):
> javascript/auto: (The default one in webpack 3) Javascript module with all module systems enabled: CommonJS, AMD, ESM
> javascript/esm handles ESM more strictly compared to javascript/auto:
> Imported names need to exist on imported module
> Dynamic modules (non-esm, i. e. CommonJs) can only imported via default import, everything else (including namespace import) emit errors
> In .mjs modules are javascript/esm by default
In my understanding setting the value `javascript/auto` tells webpack that it allows for `mjs` files to be not ESM strict.
This is a kind of hack and curcumvents the issue. In a proper setup `mjs` should only be handled as esm modules and nothing else.
So instead of changing how webpack sees `mjs` file we might want to
revert the change that introduced this issue.
References
- webpack/webpack#16213 (comment)
* chore(internal): setup `dendron-plugin-views` build to prefer `main` entry field
References
- webpack/webpack#6459 (comment)
- graphql/graphql-js#1272 (comment)
- apollographql/apollo-link-state#302 (comment)
* chore(internal): reverting to prevent increased bundle size
Webpacks's treeshaking is negatively impacted by telling it to prefer
`main` field instead of `module`. `module` point to esm modules which
are what webpack needs to do its [treeshaking](https://webpack.js.org/guides/tree-shaking/).
* chore(internal): pin version of `zod-validation-error`
Intead of changing ``dendron-plugin-views` webpack build config this
commits pins `zod-validation-error` to an older version within its
dependency to `@swc/helpers` does not conflict with webpack rules.
0 commit comments