Hello! I have a local copy of a JS Repo. I want to import the uncompiled version of that JS Repo. In case of Vanilla JS to use this library I just need to import these JS Files as shown in Image 2. How do I achieve the same in a React Typescript project? That JS library also exposes typings in externs folder.
#Importing JS Files of a Library in React Typescript Project
13 messages · Page 1 of 1 (latest)
!helper
@hoary rose cant you just npm link
I was able to do that by creating an index.js file in my JS base library and exporting the required dependencies however I am getting this error
Uncaught SyntaxError: The requested module '/@fs/D:/Github/Private/limetree/packages/shaka-player/dist/shaka-player.compiled.js' does not provide an export named 'default' (at layout.tsx:5:8)
This is how I am importing it
the error is pretty much self explanatory?
did you change export signature
Yes it is, But actually there was no such file exported from index.js earlier I was just restricted to use compiled version now to make use of uncompiled version I created this index.js file where I have exported the files I require
So earlier I just did import shaka from 'shaka-player/dist/shaka-player.compiled.js'
This doesn't allow me to modify the source code of shaka-player
For the same reason, to use uncompiled version which is purely JS based, I created this default export
are you sure you are building it correctly
Sorry, just to clarify to in case of uncompiled version I dont need to build. Those are just vanilla JS files which possibly as IIFE and I want to import those
whats stopping you from building it though