fix: console errors in Windows-based build (#1228) #1236
Merged
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.
It turns out that the "test" property in the Webpack build needs to be in a different format on Windows, otherwise it never matches, which means that our file at "scripts/build/version.js" doesn't pass through the val-loader, and in turn means that we produce untransformed output that IE 11 will choke on (an arrow function, and even if we fixed it, it would probably choke on the backticks).
You can make the build work on Windows by passing
path.resolve('scripts/build/version.js')
instead; this produces an absolute path with the appropriate Windows-style backslashes. But then the build doesn't work on macOS. If you try to make it a relative path (path.relative('', path.resolve(...))
) then Webpack rejects it.So, the solution is to make a RegExp with the backslashes (if present) escaped.
Test plan: build on macOS and Windows (with
yarn build
,yarn start
) and confirm console errors are gone and version is correctly transpiled. Note that the demo misbehaves still on IE 11 (not console errors, but some misbehavior of the editor itself, but I think that's expected).Closes: #1228