-
Notifications
You must be signed in to change notification settings - Fork 34
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Update Dependencies & move to full ES Modules #432
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Update paket & fake
Note: There are some changes in `3.4` which result in an error: ``` [...]\ts2fable\build\test\functionTests.js:1 Error [ERR_REQUIRE_ESM]: require() of ES Module [...]\ts2fable\build\test\fable_modules\fable-library.3.4.0\Util.js not supported. Instead change the require of Util.js in null to a dynamic import() which is available in all CommonJS modules. ``` -> not yet updated to `3.4.x`
Because of dependency conflicts: Move packages used to test ts2fable to their own `package.json` in `./test-modules/`. These are only packages that are used in unit tests or test compile as input for ts2fable. Packages used inside ts2fable, test and web-app are still in `package.json` in the root folder. Note: root `package.json` isn't cleaned up yet. Only `ReactXP` was removed because of conflicts. **Note**: `node-sass` currently doesn't work with `Node 17`
New Fable version doesn't work without `"type"="module"` in package.json (or transforming the generated code). -> Update all code to use ES Modules instead of commonjs & `--require esm`. But this doesn't work with too old node versions (requires `^12.20.0 || ^14.13.1 || >=16.0.0`). Notes: * Published Program (`./dist/ts2fable.js`, with `dotnet fake --target Cli.BuildRelease`) uses ES Modules too! Though it can be transformed so it works without ES Modules (`--format UMD`, like it was before). It would require a `package.json` without `type=module`. Which means: either custom `package.json` in `./dist/` or removing `type=module` from `package.json` in `build-update.package.js` (`dotnet fake --target Cli.Publish`). But this would complicate testing while development because it now doesn't work with `type=module`. -> Easiest to publish program in ESM format. * web-app isn't updated yet! * `--require esm` isn't necessary any more (and in fact erroneous) * typescript MUST be imported with `import ts from "typescript"` instead of `import * as ts from "typescript"` Reason: (source: [node docs](https://nodejs.org/api/esm.html#import-statements)) > When importing CommonJS modules, the module.exports object is provided as the default export. -> `import * as ts from ...` -> api is available via `ts.default`, but with `import ts from ...` it can be directly used with just `ts` * `__dirname` [isn't supported any more in ESM](https://nodejs.org/dist/latest-v17.x/docs/api/all.html#esm_no-__filename-or-__dirname) * [`require`](https://nodejs.org/dist/latest-v17.x/docs/api/all.html#esm_no-require-exports-or-moduleexports) cannot (easily) be used to load json. * Because of `"type"="module"`: cannot use `require`, but instead `import`
`Shell.copyDir` copies files recursively
Note: `web-app` still doesn't run -- this just updates webpack
But still issue: Editor function don't work (like highlighting; tranforming to F# works)
Note: dev build doesn't work: `module.hot` is not defined in ESM. Requires `import.meta.webpackHot`. But several modules use `module.hot` -> error when running wep-app. This is only an issue in dev build. Production build removes `module.hot` -> works
Empty `web-app/package.json`: override root `package.json` with `type=module` -> use "default" with webpack Note: Currently something is wrong with webpack processing: * very slow (2x compared to current master) * very large output: `ts.worker.js` is `4.7MB`, `vender.js` is `5.1MB`
Loader with `react-monaco-editor` didn't work any more. `@monaco-react/react` works even with default settings (and without requirejs) -> for monaco only small parts are loaded and loaded `tsWorker.js` is way smaller (`1MB`) BUT: `ts.worker.js` is still published in `./output`. Why? Isn't loaded runtime. Additional: other bundles (`app` and especially `vendor` are still huge)
-> small files instead of HUGE bundle Positive sideeffect: Remove `monaco-editor-webpack-plugin`. Was Reason for very slow webpack builds Remove requirejs Move `Copy Monaco files` from Fake build script to webpack
Note: projects aren't moved to `net6.0`: not yet supported by FAKE
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
6.0.100
(from3.1.404
)5
), but was released not too long agonet5.0
net6.0
isn't supported by FAKE yet. But shouldn't make really a different -- after all we are compiling to JS with Fabletest-compiles
totest-compiles/package.json
(otherwise: dependency resolution issues)sass
instead ofnode-sass
node-sass
is deprecated, and only maintained to "work". It breaks with every new node version until an update. Additional doesn't yet work with just VS 2022 installed.Dart sass
doesn't rely on external tools -> Works better with new node versions.@monaco-react/react
instead ofreact-monaco-editor
react-monaco-editor
doesn't work with new monaco version, while@monaco-react/react
does. Additionalreact-monaco-editor
removed support for a custom loader (to load monaco from./libs/vs/...
)typescript
still (very) old version: errors with new versions (even with newer3.X
) -> requires more rework (not in this PR)type=module
inpackage.json
./build/
and./dist
--require esm
any morets2fable
appveyor.yml
to use matching dotnet and new node