0
0

More than 5 years have passed since last update.

Parcel v1.9.xで Cannot destructure property `parser` of 'undefined' or 'null'. が出るときは

Posted at

tl;dr

parcel-plugin-typescriptのバージョンを1.0.0まで上げましょう

環境

  • Parcel: v1.9.0以降
  • TypeScript

状況

Parcel v1.8.xのプロジェクトでParcelのバージョンを上げると以下のようなエラーが発生しました

🚨  /my/project/src/index.pug: Cannot destructure property `parser` of 'undefined' or 'null'.
    at Object.MakeTranspileAsset (/my/project/node_modules/parcel-plugin-typescript/build/frontend/assets/classes/transpile.js:7:24)
    at new module.exports (/my/project/node_modules/parcel-plugin-typescript/build/frontend/assets/forked.js:6:43)
    at Parser.getAsset (/my/project/node_modules/parcel-bundler/src/Parser.js:81:12)
    at HTMLAsset.addURLDependency (/my/project/node_modules/parcel-bundler/src/Asset.js:115:8)
    at HTMLAsset.processSingleDependency (/my/project/node_modules/parcel-bundler/src/assets/HTMLAsset.js:89:26)
    at ast.walk.node (/my/project/node_modules/parcel-bundler/src/assets/HTMLAsset.js:138:43)
    at traverse (/my/project/node_modules/posthtml/lib/api.js:105:26)
    at traverse (/my/project/node_modules/posthtml/lib/api.js:111:5)
    at traverse (/my/project/node_modules/posthtml/lib/api.js:105:17)
    at traverse (/my/project/node_modules/posthtml/lib/api.js:111:5)

PugであろうがHTMLであろうがこのエラーが発生してしまいます

原因

このプロジェクトで使用していたparcel-plugin-typescriptv0.7.1と少し古いのが原因だったようです

対応

$ yarn add -D parcel-plugin-typescript

でプラグインのバージョンをv1.0.0まで上げたらエラーは解消されました

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0