Svelteで500エラーに.. ``` Failed to resolve module specifier "crypto". Relative references must start with either "/", "./", or "../". TypeError: Failed to resolve module specifier "crypto". Relative references must start with either "/", "./", or "../". ``` ``` npm install @rollup/plugin-json --save-dev ``` `rollup.config.js`も設定する https://stackoverflow.com/questions/59899928/sapper-svelte-rollup-plugin-json-giving-error-with-stripejs 直らず.. よく見るとこんなのが出てる。 ``` 'crypto' is imported by node_modules\crypto-js\core.js, but could not be resolved – treating it as an external dependency 'crypto' is imported by crypto?commonjs-external, but could not be resolved – treating it as an external dependency ``` Sapperのせいではない https://github.com/sveltejs/sapper/issues/1223 https://github.com/entronad/crypto-es というのもありそう これを使う ``` npm install fast-sha256 ``` だめ ### jsSHAを使う [[jsSHA]]でいけた😊 ``` npm install jssha ``` ```ts import JsSHA from "jssha"; const sha = new JsSHA("SHA-256", "TEXT"); sha.update("input"); const hash = sha.getHash("HEX"); ```