Comments (6)
I have tried it with the latest CRA and have confirmed this issue.
It appears that the CommonJS style with require
has a problem with the bundler and returns the location of the file.
const f = require("@petamoriken/float16");
console.log(f); // => "/static/media/index.9ea9595cf22b971e0a2e.cjs"
On the other hand, the ES Module style seems to work fine.
import { getFloat16 } from '@petamoriken/float16';
function conversion(value) {
var buffer = new ArrayBuffer(4);
var view = new DataView(buffer);
view.setUint16(0, value);
return getFloat16(view, 0, false);
}
from float16.
Potentially an issue with CRA Add support for CJS files #12700
from float16.
I can confirm that - I've just posted a comment on the CRA issue - this is how i've worked around it for now: facebook/create-react-app#12700 (comment)
from float16.
To verify other libraries work i've also required lodash:
const array = require('lodash/array');
and simply print within the conversion function at beginning:
console.log(array.chunk(['a', 'b', 'c', 'd'], 2));
No issues there.
Could be some mismatch in the way float16 is exported?
from float16.
Or webpack in general since main and module is defined in package.json webpack/webpack#5756 (comment)
from float16.
Probably a CJS issue for the CRA.
Line 41 in ccd5cf9
from float16.
Related Issues (11)
- Float16Array constructor doesn't work with SharedArrayBuffers HOT 1
- Conversion fails in some cases HOT 3
- Using float16 in WebGL2? HOT 5
- Example does not work, map returns Proxy Object HOT 1
- Issue in converting float16 to float32 HOT 1
- Float16Array lookups appear to be much less performant compared to Float32Array lookups HOT 3
- Uncaught Error: Module build failed (from ./node_modules/babel-loader/lib/index.js): Error: ~project/node_modules/@petamoriken/float16/browser/float16.js: unknown Statement of type "ForOfStatement" HOT 1
- float16.js: unknown Statement of type "ForOfStatement" HOT 1
- conversions to float16 are incorrect for very small numbers HOT 1
- typescript can't package types
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 float16.