ERROR in ./node_modules/jsencrypt/lib/index.js 1:0-40
ashokram opened this issue · 10 comments
Having the same issue. Reverting the version is the only solution I've found so far. @travist, is this something you can investigate?
same error
Please do not make breaking change in patch version 😥
Hi everyone I have find as a temporary solution is to change the version of jsencrypt to "jsencrypt": "^3.0.0-rc.1", that can fix the problem
The problem is because of webpack5 have change the way it builds the project dependencies.
Have a good day
This config will solve the problem.
module.exports = {
// ...
module: {
rules: [
{
test: /\.m?js$/,
resolve: {
fullySpecified: false, // disable the behaviour
},
},
],
},
};
When package.json contains a field of "type" with the value of "module" , webpack requires a full path(including the file extension, like .js/.mjs),otherwise webpack would fail the compiling with a Module not found error. Setting fullySpecified to false disables this behavior.
You can check it at Webpack docs.
For me this just looks like a small patch and no solution, additionally we don't have an appropriate loader for this config.
The problem still exists with the new version 3.3.1 😉
It seems the tsconfig not set to output an ESM. So the generated JS files import without the ".js" extname.
NOT A GOOD PRACTICE:
just
import 'jsencrypt/bin/jsencrypt'
and you have a global JSEncrypt.
using it anywhere:
const enc = new JSEncrypt()
How to solve this problem in umijs and how to configure it on chainWebpack!
Please try 3.3.2 and see if it fixes this issue.