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

Tree shaking for JSON imported variables [feature request] #5578

Closed
damianobarbati opened this Issue Aug 26, 2017 · 3 comments

Comments

Projects
None yet
3 participants
@damianobarbati

damianobarbati commented Aug 26, 2017

Code sample:

import { name, version } from './package.json';

Right now final bundle will hold full package.json object both in dev and prod mode (dependencies, scripts and so on).
Webpack could transpile the statement into ES imports and tree shake unused vars just as it does for javascript.

Why not implementing this with an additional plugin?
Since one of webpack goals is to reduce bundle size I don't see why not implementing this as a core feature 🤔.

@sokra sokra added this to the webpack 4.x milestone Dec 5, 2017

@graingert

This comment has been minimized.

Show comment
Hide comment
@sokra

This comment has been minimized.

Show comment
Hide comment
@sokra

sokra Jan 4, 2018

Member

4 -> before v4 release
4.x -> after v4 release

Member

sokra commented Jan 4, 2018

4 -> before v4 release
4.x -> after v4 release

@sokra

This comment has been minimized.

Show comment
Hide comment
@sokra

sokra Jan 4, 2018

Member

This is done

Member

sokra commented Jan 4, 2018

This is done

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment