mike-engel / babel-plugin-bucklescript

Write ReasonML and Bucklescript in your existing babel projects
Other
77 stars 5 forks source link

use filename instead of filenameRelative for Babel v7 compat #6

Closed tmepple closed 6 years ago

tmepple commented 6 years ago

I was trying to get this plugin to work with Babel v7 (beta) to test using it with the latest beta (v6 canary) version of NextJS's with-reasonml example. For some reason it seems like the state passed to ImportDeclaration no longer includes state.filename.opts.filenameRelative as it's undefined causing it to fail.

Changing it to use state.filename.opts.filename instead works properly for Babel v6 and v7 (beta) and passes tests.

codecov-io commented 6 years ago

Codecov Report

Merging #6 into master will not change coverage. The diff coverage is 100%.

Impacted file tree graph

@@          Coverage Diff          @@
##           master     #6   +/-   ##
=====================================
  Coverage     100%   100%           
=====================================
  Files           1      1           
  Lines          54     54           
  Branches        6      6           
=====================================
  Hits           54     54
Impacted Files Coverage Δ
index.js 100% <100%> (ø) :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 fb659b1...94c079c. Read the comment docs.

tmepple commented 6 years ago

Further testing shows that hot reloading is causing a ModuleNotFound error with my implementation... will close this PR and open a new one when resolved.

tmepple commented 6 years ago

ModuleNotFound issue was caused by an inconsistent version of bs-platform which is unrelated. Reopening since this is a good PR.

mike-engel commented 6 years ago

Thanks a bunch @tmepple! I've published 0.4.0 with this PR.