New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
es2015 transpile not possible for extending classes outside of project? #7221
Comments
Hey @PizzaE! We really appreciate you taking the time to report an issue. The collaborators If you need any help, or just have general Babel or JavaScript questions, we have a vibrant Slack |
Do you transpile test.js when it is moved outside the project? If not, this bug would be fixed by #7081 |
@nicolo-ribaudo I am not entirely sure what you mean by that. I simply have my files in the structure above and run webpack with babel. Perhaps this may be a webpack bug? |
Can you check in your webpack output if the |
Yes it is transpiled I think. If I try to create a new class with the abstract class, it works, e.g:
but not the extends |
It might work because your browser supports classes. Can you search |
I don't know what |
I meant in the file generated by webpack |
I am having exactly the same issue. in my case the imported class is not transpiled. |
@MarshallRJ It is likely a configuration error. Can you post:
|
@nicolo-ribaudo I'm assuming the file generated by webpack is my bundle file? I do have some code in there with |
Thanks, can do. I am running a node project tests using babel-register in the main project root
file that extends the class : let CatchupSubscription = require('rms-event-sourcing').CatchupSubscription;
class CatchupSubscriptionMeterCalendars extends CatchupSubscription {
constructor(options) {
super(new EventStoreClient().http(), '$ce-Meter', onEventReceived, onSave, options);
}
}
module.exports = CatchupSubscriptionMeterCalendars In the node modules class that is extended (not transplied no bablel in the project) class CatchupSubscription {
constructor(esClient, streamName, onEventReceived, onCaughtUp, options = {}) {
....
}
module.exports = CatchupSubscription; I do not have a webpack.config.js file |
// package-2/index.js
require("babel-register");
require("../package-1/index.js"); If you run Babel inside I'd suggest to either pass the configuration directly to @MarshallRJ If you expect it to work without transpiling the |
.babelrc
"presets": ["es2015"],
I have a directory structure that goes like this:
test.js
test2.js
If I have both
test.js
andtest2.js
withinfolder2
, it works fine. Even if I create another folder insidefolder2
and put the abstract class inside, everything is fine.However, the moment I try to move
test.js
outside of my "project", it doesn't work. (My repo is structured to have multiple "mini projects").Importing other files in this manner, i.e. outside the project still works, but it just doesn't work for when I try to
extend
a class.This is the error that I get in my browser, when it doesn't work:
The text was updated successfully, but these errors were encountered: