←back

run astro build時に findup がimportできない?

2022/10/04

↑の作業も大詰めになったタイミング。vercelにdeployしますか。。えらー?

findUp ?

Bash
generating static routes 
 error   Named export 'findUp' not found. The requested module 'find-up' is a CommonJS module, which may not support all module.exports as named exports.
  CommonJS modules can always be imported via the default export, for example using:
  
  import pkg from 'find-up';
  const { findUp } = pkg;
  
file:///Users/kdaviso/code/2022-astro-portfolio/dist/entry.mjs?time=1664853847045:20
import { findUp } from 'find-up';
  • いつのタイミングかは不明だけど、エラーでbuildできなくなってた

とりあえず 最新版の findUp をinstall

https://github.com/withastro/astro/issues/1647

↑に倣って、無心でinstall。。もやるけど一応解消。


/public/images/astronotion/5ab7f913-2d7e-4592-b15b-8046fac98ef6_Untitled.png
  • 今度はこちら。notionの記事ページが見れなくなってしまった。。
JavaScript
// https://astro.build/config
export default defineConfig({
  integrations: [tailwind(), react(), astroImageTools],
  vite: {
    ssr: {
      noExternal: ['astronotion', 'findUp'] // findUpを追加
    }
  }
})
  • ↑で解決

Cannot read properties of undefined (reading '0') ??

  • npm run build時に10個目の記事でfailする。。
JavaScript
// NotionBlockItemBookmark.astro?LL29-L31

<strong class={`${bemClass}__anchor__title`}>
	{title[0][0]}
</strong>

// titleのnullチェックでおちてるぽい
  • bookmark先でtitleやdescriptionが設定されてない場合にnullで落ちる。なんでやねん
←back