nuxt / components

Scan and auto import components for Nuxt.js 2.13+
MIT License
887 stars 48 forks source link

fix: webpack magic comments #236

Closed nozomuikuta closed 2 years ago

nozomuikuta commented 3 years ago

This PR fixes #197 as the following:

Fix types

197 forcefully converts prefetch and preload options to boolean while I implemented a ternary logic to handle the case where they are numbers, according to Webpack's magic comment syntax.

Add missing logic

197 didn't modify component.asyncImport string that is used to generate the source code in loader.ts.

Rather, it just modified magic comments in templates/components/index.js (and plugin.js at that time), which is for local development.

To avoid recalculation, I added it to Component type that a new property magicComment, which is a string.

Let me request review from @pi0 and @clarkdo, same as #197.

codecov[bot] commented 3 years ago

Codecov Report

Merging #236 (0201d2b) into main (f8667b6) will increase coverage by 0.30%. The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##             main     #236      +/-   ##
==========================================
+ Coverage   86.28%   86.59%   +0.30%     
==========================================
  Files           7        7              
  Lines         175      179       +4     
  Branches       47       49       +2     
==========================================
+ Hits          151      155       +4     
  Misses         24       24              
Impacted Files Coverage Δ
src/scan.ts 98.30% <100.00%> (+0.12%) :arrow_up:

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update f8667b6...0201d2b. Read the comment docs.