Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(es-dev-server): don't transform non-modules (#1067)
- Loading branch information
1 parent
750322b
commit 8ad6d03
Showing
10 changed files
with
81 additions
and
13 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
import { html, render } from 'lit-html'; | ||
import module from './module-features-a.js'; | ||
|
||
window.__importMeta = import.meta.url.endsWith('syntax/module-features.js'); | ||
window.__importMeta = import.meta.url.indexOf('syntax/module-features.js') > 0; | ||
window.__staticImports = module === 'moduleFeaturesA'; | ||
window.__dynamicImports = (async () => (await import('./module-features-b.js')).default === 'moduleFeaturesB')(); |
14 changes: 14 additions & 0 deletions
14
packages/es-dev-server/src/browser-scripts/system-js-legacy-resolve.js
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
export default ` | ||
<script> | ||
(function() { | ||
// appends a query param to each systemjs request to trigger es5 compilation | ||
var originalResolve = System.constructor.prototype.resolve; | ||
System.constructor.prototype.resolve = function () { | ||
return Promise.resolve(originalResolve.apply(this, arguments)) | ||
.then(function (url) { | ||
return url + (url.indexOf('?') > 0 ? '&' : '?') + 'transform-module'; | ||
}); | ||
}; | ||
})() | ||
</script> | ||
`; |
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
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
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
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
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
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
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
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