Comments (4)
Could you share more detail about your use case? webpack config? A minimal reproduceable example will be better.
from iso-639-1.
@meikidd I was able to reproduce the issue using โwebpack 4 React boilerplateโ https://github.com/FerJSsilva/webpack-4-react-boilerplate
So all I did is just clone https://github.com/FerJSsilva/webpack-4-react-boilerplate.git
You can find all the webpack4 config changes under folder config here https://github.com/FerJSsilva/webpack-4-react-boilerplate/tree/master/config
steps done to reproduce issue -
npm install iso-639-1
And in App.jsx I added below code
import React, { Component } from 'react';
import logo from '../assets/images/logo.svg';
const ISO6391 = require('iso-639-1'); //imported
class App extends Component {
render() {
console.log("ISO6391 object",ISO6391);
//This below code breaks
console.log("ISO6391",ISO6391.getNativeName('en'));
console.log(ISO6391.getCode('Chinese'))
// fix done
//console.log("ISO6391 en",ISO6391.default.getName('en')); // working
//console.log("ISO6391 Chinese",ISO6391.default.getCode('Chinese')) // working
return (
<div className="App">
<header className="App-header">
<img src={logo} className="App-logo" alt="logo" />
<h1 className="App-title">Welcome to React using ISO6391</h1>
<h3>GetNativeName code('en'): {ISO6391.default.getName('en')}</h3>
</header>
</div>
);
}
}
export default App;
Errors
Uncaught TypeError: ISO6391.getNativeName is not a function
at App.render (VM428 main.005bf661e281ebe238ed.js:36991)
at finishClassComponent (VM428 main.005bf661e281ebe238ed.js:18934)
at updateClassComponent (VM428 main.005bf661e281ebe238ed.js:18889)
at beginWork (VM428 main.005bf661e281ebe238ed.js:19837)
at performUnitOfWork (VM428 main.005bf661e281ebe238ed.js:23505)
at workLoop (VM428 main.005bf661e281ebe238ed.js:23545)
at HTMLUnknownElement.callCallback (VM428 main.005bf661e281ebe238ed.js:4342)
at Object.invokeGuardedCallbackDev (VM428 main.005bf661e281ebe238ed.js:4392)
at invokeGuardedCallback (VM428 main.005bf661e281ebe238ed.js:4449)
at replayUnitOfWork (VM428 main.005bf661e281ebe238ed.js:22771)
PFA the screenshots of the errors for the same i see
Note: As mentioned above i was able to fix doing as below
console.log("ISO6391 en",ISO6391.default.getName('en')); // working
console.log("ISO6391 Chinese",ISO6391.default.getCode('Chinese')) // working
Can you please help here for a proper fix for webpack4 .
Thanks.
from iso-639-1.
Hi @Bopaiah-MD , should use es6 module import instead of commonjs import:
๐correct
import ISO6391 from 'iso-639-1';
๐wrong
const ISO6391 = require('iso-639-1');
I'll update the readme later to make it clear.
from iso-639-1.
๐ works , thanks for Quick response @meikidd .
from iso-639-1.
Related Issues (20)
- Support three letter codes HOT 3
- Usage with TypeScript HOT 4
- Cyrillic vs Latin variants HOT 3
- .validate behaves incorrectly for prototype property names as code HOT 1
- Changelog? HOT 2
- FEATURE: Capitalize the first letter of all languages HOT 6
- License is missing HOT 1
- Should be "Polski" instead "jฤzyk polski" HOT 1
- Missing Montenegrin localization HOT 2
- How about iso-639-2 languages? HOT 1
- ChainAlert: npm package release (2.1.14) has no matching tag in this repo HOT 1
- validate fn expecting LanguageCode instead string HOT 2
- TypeError: Cannot read properties of undefined (reading 'toLowerCase') HOT 1
- ISO6391 ES6 import undefined HOT 1
- import as ES module give me an undefined object HOT 5
- Types are not exported HOT 3
- Miss 2 languages bh and sh
- Incorrect typing.
- Add language: Brazilian Portuguese
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. ๐๐๐
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google โค๏ธ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from iso-639-1.