vuejs / vue

This is the repo for Vue 2. For Vue 3, go to https://github.com/vuejs/core
http://v2.vuejs.org
MIT License
207.98k stars 33.68k forks source link

Uncaught TypeError: t._v is not a function #5386

Closed medz closed 7 years ago

medz commented 7 years ago

Version

2.2.6

Reproduction link

https://github.com/zhiyicx/thinksns-plus/commit/2cbf338b2eb7dd1da40230109c1505f08141e200

Steps to reproduce

Clone:

git clone https://github.com/zhiyocx/thinksns-plus plus
cd plus
git reset –hard 2cbf338b2eb7dd1da40230109c1505f08141e200

Since the project incorporates laravel, so install the program first:

php -r "file_exists('.env') || copy('.env.example', '.env');
composer install
php artisan key:generate

The next step, configure the mysql information, edit the .env file.

Because the background directly into the template data is mysql query, so not configured can not run.

Then the browser opens yousite / admin

You can also reproduce compiled static resources.

yarn install
yarn dist

If you are running the yarn dev command, there will be no problem.

What is expected?

After the split package, the program is running normally.

What is actually happening?

Split compression package, the console error.


webpack.config.bable.js 中,有一个:

...
resolve: {
    'vue$': `vue/dist/vue.common.${isProd ? 'min.js' : 'js'}`,
}

配置,如果设置为 :

...
resolve: {
    'vue$': `vue/dist/vue.common.js`,
}

就不会有问题。

在实际打包过程中,vue.common.min.js 文件打包出来的 vendor.js 比不使用 .min 大约小 30kb 左右。

目前排查出的问题就在这里。因为使用了 .min 的原因,导致 t._v 提示找不到。

medz commented 7 years ago

其实,我提交这个 issue 的目的主要是想问一下,如何在使用 .min 的情况下,缩小 30kb 左右的文件大小的同时,不会报错呢。我没觉得作为类库的.min 压缩不应该更换方法名称。

yyx990803 commented 7 years ago

...不要这样配置。用 webpack 的 UglifyJS 插件统一压缩。