Given
import test from './test.js';
import test2 from './test.mjs';
and test.js
and test.mjs
both containing
class A {
test() {
console.log('from mjs'); // or console.log('from js');
}
}
export default A;
Babel transpiles
[...];
(0, _createClass2.default)(A, [{
key: "test",
value: function test() {
console.log('from js');
}
}]);
[...]
class A {
test() {
console.log('from mjs');
}
}
[...]
How should I configure babel to treat *.mjs
files exactly like *.js
files. I need them to be *.mjs
files so that I can run it in node
without transpilation.
Plugins I am currently explicitly adding are
'@babel/plugin-proposal-class-properties', '@babel/plugin-transform-runtime', '@babel/plugin-transform-classes'