okta-react icon indicating copy to clipboard operation
okta-react copied to clipboard

npm module missing `dist` folder

Open austinbruch-sas opened this issue 6 years ago • 3 comments

Having recently updated patch versions of @okta/okta-react from 3.0.3 to 3.0.8, it appears that the dist folder is no longer included in the package as installed by npm.

With this issue, imports such as

import { useOktaAuth } from '@okta/okta-react/dist/OktaContext';

no longer function.

Is this an intentional change? I wouldn't have expected this to happen within a patch release.

It has been several months since the above import statement (and ones like it) were originally implemented in my application, so I don't recall the exact rationale for using that pattern instead of import { useOktaAuth } from '@okta/okta-react';, but I'm guessing the former not officially supported by Okta. Is that correct?

Any guidance would be greatly appreciated!

austinbruch-sas avatar Oct 21 '20 19:10 austinbruch-sas

@austinbruch-sas import { useOktaAuth } from '@okta/okta-react' is the correct way to import from the library. I am not sure why the previous syntax would have been used, but it is not supported. Possibly this line was added automatically by a tool such as an IDE?

aarongranick-okta avatar Oct 21 '20 19:10 aarongranick-okta

@aarongranick-okta Thanks for the quick response. Digging back further, it looks like we referenced dist specifically because the default imports (from the src folder within the npm package) needed transpilation to convert JSX into vanilla JS, which we didn't intend to support for modules coming from node_modules.

From the looks of it in the latest version (3.0.8), the files in the src folder of the npm package have already been transpiled to convert JSX to vanilla JS, which should solve our original problem with using those files.

austinbruch-sas avatar Oct 21 '20 19:10 austinbruch-sas

@austinbruch-sas Thanks for the feedback! Close the issue for now, please feel free to reopen it if the issue still exists.

shuowu avatar Jan 28 '21 15:01 shuowu