I'm planning on using Webpack 4 in the future and am currently on Webpack 3. I'd like to get the full benefit of tree-shaking and want to make sure I'm importing rxjs correctly in my projects.
First, Webpack 4 has a thing that restricts you to either cjs, esm, or any import format. Webpack 3 does not have this, but does utilize tree-shaking where it exists.
When I do:
import { bindCallback } from 'rxjs/observable/bindCallback'
Am I using the cjs method and tree-shaking or will this automatically use esm if available?
From using other libraries like date-fns, I believe I have to do this instead:
import { bindCallback } from 'rxjs/_esm2015/observable/bindCallback'
Is my assumption correct, or do I keep calling imports like I've always been doing (the first example)?
I'm planning on using Webpack 4 in the future and am currently on Webpack 3. I'd like to get the full benefit of tree-shaking and want to make sure I'm importing rxjs correctly in my projects.
First, Webpack 4 has a thing that restricts you to either cjs, esm, or any import format. Webpack 3 does not have this, but does utilize tree-shaking where it exists.
When I do:
Am I using the cjs method and tree-shaking or will this automatically use esm if available?
From using other libraries like date-fns, I believe I have to do this instead:
Is my assumption correct, or do I keep calling imports like I've always been doing (the first example)?