Skip to content
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

bundle file does not include compile function and template cannot be compiled even vue is aliased as 'vue/dist/vue.esm-bundler.js' #1263

Closed
yamacent opened this issue May 29, 2020 · 1 comment

Comments

@yamacent
Copy link

Version

3.0.0-beta.14

Reproduction link

https://github.com/yamacent/vue-next-minimal-reproduction-tree-shaking

Steps to reproduce

$ git clone git@github.com:yamacent/vue-next-minimal-reproduction-tree-shaking.git
$ cd vue-next-minimal-reproduction-tree-shaking
$ npm install
$ npx webpack

# open dist/index.html in the browser and nothing will be shown

# un-comment `console.log(compile)` in `src/index.js`
$ npx webpack

# open dist/index.html again and `hello` will be shown this time

What is expected?

hello is shown even console.log(compile) does not exist

What is actually happening?

nothing is shown when console.log(compile) does not exist


Tree Shaking may be the cause.
https://webpack.js.org/guides/tree-shaking/

if sideEffects is set to true, it works fine.
https://github.com/vuejs/vue-next/blob/master/packages/vue/package.json#L10

@underfin
Copy link
Member

underfin commented Jun 7, 2020

Yeah.https://github.com/vuejs/vue-next/blob/master/packages/vue/src/index.ts#L72 registerRuntimeCompiler(compileToFunction) is an sideEffect for webpack build this.

See webpack/webpack#10978 (comment). Maybe we should change sideEffect: true for has internal evalution exports.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants