Skip to content
This repository has been archived by the owner on Jul 29, 2019. It is now read-only.

updated the webpack documentation #3295

Merged
merged 2 commits into from
Jul 26, 2017
Merged

updated the webpack documentation #3295

merged 2 commits into from
Jul 26, 2017

Conversation

mojoaxel
Copy link
Member

@mojoaxel mojoaxel added this to the Minor Release v4.21 milestone Jul 26, 2017
@yotamberk yotamberk merged commit 435a2ab into develop Jul 26, 2017
@SeanSilke
Copy link

SeanSilke commented Jul 27, 2017

@mojoaxel Can we achieve tree shaking with babel-plugin-transform-imports?

@mojoaxel
Copy link
Member Author

mojoaxel commented Jul 27, 2017

@mojoaxel Can we achieve tree shaking with babel-plugin-transform-imports?

@SeanSilke I have no idea.
Please experiment with it and document your findings in #2186 or in the demo project.

@SeanSilke
Copy link

SeanSilke commented Jul 27, 2017

@mojoaxel Firs of all thank you for the work!
Please add some clarity to my observation.
There is seem to be significant difference between babel-plugin-transform-imports and what you done.
babel-plugin-transform-imports just transform input to point exactly to the needed parts.
What you are doing is rebuilding part of the project.
So tree shaking can't be achieved with transform-imports even if it right configured. Correct?

@mojoaxel mojoaxel deleted the webpackDocs branch July 27, 2017 20:23
@mojoaxel
Copy link
Member Author

mojoaxel commented Jul 27, 2017

If you manually defined the parts you want to import the babel-plugin-transform-imports makes no difference:

import { DataSet, Network } from 'vis/index-network';
import DataSet from 'vis/lib/DataSet';
import Network from 'vis/lib/network/Network';

Here babel-plugin-transform-imports might help because "index-network" also exports unnecessary stuff like moment.js and hammer.js that you might have imported already. Webpack >2 already supports unused module export detection so I don't think the plugin is needed (try it!):

import vis from 'vis/index-network';

var nodes = new vis.DataSet(...
var network = new vis.Network(...

What you definitive should not do is importing the dist version. Than, not even the babel-plugin-transform-imports can help:

import vis from 'vis/dist/vis';

var nodes = new vis.DataSet(...
var network = new vis.Network(...

For further discussions please use an issue. Thanks!

primozs pushed a commit to primozs/vis that referenced this pull request Jan 3, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants