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
ESM distributable doesn't work in browsers #1667
Comments
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>Untitled</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
</head>
<body>
<!--
JSPM Generator Import Map
Edit URL: https://generator.jspm.io/#U2VhYGBkDM0rySzJSU1hyDS0yEutKHEwMtQDQgAg6loiHQA
-->
<script type="importmap">
{
"imports": {
"i18next": "https://ga.jspm.io/npm:i18next@21.1.1/dist/esm/i18next.js"
},
"scopes": {
"https://ga.jspm.io/": {
"@babel/runtime/helpers/esm/assertThisInitialized": "https://ga.jspm.io/npm:@babel/runtime@7.15.4/helpers/esm/assertThisInitialized.js",
"@babel/runtime/helpers/esm/classCallCheck": "https://ga.jspm.io/npm:@babel/runtime@7.15.4/helpers/esm/classCallCheck.js",
"@babel/runtime/helpers/esm/createClass": "https://ga.jspm.io/npm:@babel/runtime@7.15.4/helpers/esm/createClass.js",
"@babel/runtime/helpers/esm/getPrototypeOf": "https://ga.jspm.io/npm:@babel/runtime@7.15.4/helpers/esm/getPrototypeOf.js",
"@babel/runtime/helpers/esm/inherits": "https://ga.jspm.io/npm:@babel/runtime@7.15.4/helpers/esm/inherits.js",
"@babel/runtime/helpers/esm/objectSpread": "https://ga.jspm.io/npm:@babel/runtime@7.15.4/helpers/esm/objectSpread.js",
"@babel/runtime/helpers/esm/possibleConstructorReturn": "https://ga.jspm.io/npm:@babel/runtime@7.15.4/helpers/esm/possibleConstructorReturn.js",
"@babel/runtime/helpers/esm/typeof": "https://ga.jspm.io/npm:@babel/runtime@7.15.4/helpers/esm/typeof.js",
"@babel/runtime/helpers/typeof": "https://ga.jspm.io/npm:@babel/runtime@7.15.4/helpers/esm/typeof.js"
}
}
}
</script>
<!-- ES Module Shims: Import maps polyfill for modules browsers without import maps support (all except Chrome 89+) -->
<script async src="https://ga.jspm.io/npm:es-module-shims@0.12.8/dist/es-module-shims.min.js" crossorigin="anonymous"></script>
<script type="module">
import * as i18next from "i18next";
// Write main module code here, or as a separate file with a "src" attribute on the module script.
console.log(i18next);
</script>
</body>
</html> |
@adrai Shims and polyfills are not really acceptable. They are not browser-native solutions (yet?). It means I still need another 3rd-party library, because a different library couldn't adhere to (current) browser-standards. |
The issue still stands and should not have been closed IMO. |
Alternative: Providing a PR adding a special export for ESM for direct browser usage including the babel runtime....https://github.com/i18next/i18next/blob/master/rollup.config.js#L8 |
v21.2.0 should have a bundled esm file: https://cdn.jsdelivr.net/npm/i18next@21.2.0/dist/esm/i18next.bundled.js |
🐛 Bug Report
ESM distributable doesn't work in browsers.
To Reproduce
Error in browser: Uncaught TypeError: Error resolving module specifier “@babel/runtime/helpers/esm/typeof”. Relative module specifiers must start with “./”, “../” or “/”.
Expected behavior
I18 usable in the browser as a module without the need for babel or other similar systems.
Your Environment
The text was updated successfully, but these errors were encountered: