0

我将我的代码与 rollupJs 捆绑在一起,它工作正常,直到我将 argon2 添加到代码库中。在添加 argon2 之前,我使用命名导出和其他加密函数工作正常。

rollup.config.js

import resolve from 'rollup-plugin-node-resolve';
import commonjs from 'rollup-plugin-commonjs';
import json from '@rollup/plugin-json';
import builtins from 'rollup-plugin-node-builtins';
import globals from 'rollup-plugin-node-globals';

export default [
    {
        input: 'dist/js/src/index.js',
        output: {
            name: 'window',
            file: 'bundle.umd.js',
            format: 'umd',
            extend: true,
            exports: 'named'
        },
        plugins: [
            resolve({
                browser: true,
                dedupe: ['crypto', 'argon'],
                preferBuiltins: true
            }),
            commonjs(),
            builtins(),
            globals(),
            json()
        ],
        // eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types
        onwarn(warning) {
            // Skip certain warnings

            // should intercept ... but doesn't in some rollup versions
            if (warning.code === 'THIS_IS_UNDEFINED') {
                return;
            }

            // console.warn everything else
            console.warn(warning.message);
        }
    }
];

错误跟踪

当我添加 argon2 进行散列时的错误

4

0 回答 0