I have an ES6 module with 4 primitive values stored in const
variables at the top of my file, along with a default function being exported. This function is imported into main.js
and Rollup bundles it into a corresponding dist/js
folder. When I look at the outputted file in dist/js
I notice that Rollup has included the 4 variables:
module.js:
const x = 1,
y = 2,
z = 3,
a = 4;
export default function startTimer() {
console.log('test');
}
main.js:
import startTimer from './path/to/module.js'
dist/js/main.js:
var x = 1,
y = 2,
z = 3,
a = 4;
function startTimer() {
console.log('test');
}
Why are the variables being imported? The function is in no way related to the variables or vice versa.
Thanks!