spencermountain / unrequired

find unused javascript files in your project
108 stars 8 forks source link

ParseError: 'import' and 'export' may appear only with 'sourceType: module' #1

Closed JoshuaKGoldberg closed 5 years ago

JoshuaKGoldberg commented 5 years ago
/Users/joshuakgoldberg/Code/src/index.js:3
import React from 'react';
^
ParseError: 'import' and 'export' may appear only with 'sourceType: module'
Unable to find a source map.
See https://github.com/danvk/source-map-explorer/blob/master/README.md#generating-source-maps

found: 30 files
using: 1 files

Could the call to source-map-explorer include sourceType: module in some CLI fashion, or could we configure that through unrequired please?

spencermountain commented 5 years ago

hey Josh, that's great that someone has found this useful. To be honest, I really have no idea. I'd be happy to support this, if it was possible cheers

JoshuaKGoldberg commented 5 years ago

Awesome! Yeah I suppose I forgot to mention, this is a super nifty tool, thanks for making & open sourcing it!

NameFILIP commented 5 years ago

I was able to solve it by adding -t [ babelify ] after --debug in the get-used.js. Looks like the source code of the published module is quite different from the master, so hopefully this will be fixed in the newest release.

spencermountain commented 5 years ago

thanks Filip! yeah, that may be a really good solution. I appreciate that.

Yeah, I got very close to getting it to work with rollup, which is slick about es6 stuff, but I'll test it a bit more this week. cheers

dinodsaurus commented 5 years ago

could you push it to a branch so we could take a look @spencermountain 🙏

spencermountain commented 5 years ago

fixed in 0.1.0