ES6 Imports are not working as described
Author: chwzrCreated Aug 9, 2018Updated May 18, 2026
When import Base64 Module ES6 Style:
import Base64 from 'crypto-js/enc-base64';
I got following error:
The requested module '../node_modules/crypto-js/enc-base64.js' does not provide an export named 'default'
and if I'm using this syntax:
import { Base64 } from 'crypto-js/enc-base64';
It says:
The requested module '../node_modules/crypto-js/enc-base64.js' does not provide an export named 'Base64'
I've also tried import * as Base64 from 'crypto-js/enc-base64' but with no luck:
TypeError: Cannot read property 'CryptoJS' of undefined
What I am doing wrong? I need the enc-utf8 and enc-base64 modules in my code.
btw: importing full Library is also not working, with similar errors :(
Source: brix/crypto-js