TypeError:尝试使用vue-bulma-tabs时,数据必须是字符串或缓冲区

mcn*_*iac 6 webpack vue.js bulma

我与vue和vue-bulma-tabs有这个奇怪的错误.

Project is running at http://localhost:8081/
webpack output is served from /dist/
404s will fallback to /index.html
crypto.js:74
  this._handle.update(data, encoding);
               ^

TypeError: Data must be a string or a buffer
    at TypeError (native)
    at Hash.update (crypto.js:74:16)
    at HarmonyExportImportedSpecifierDependency.updateHash (/Users/esteban/Projects/experiments/example1/node_modules/webpack/lib/dependencies/HarmonyExportImportedSpecifierDependency.js:144:8)
    at /Users/esteban/Projects/experiments/example1/node_modules/webpack/lib/DependenciesBlock.js:33:5
    at Array.forEach (native)
    at NormalModule.DependenciesBlock.updateHash (/Users/esteban/Projects/experiments/example1/node_modules/webpack/lib/DependenciesBlock.js:32:20)
    at NormalModule.Module.updateHash (/Users/esteban/Projects/experiments/example1/node_modules/webpack/lib/Module.js:162:41)
    at NormalModule.updateHash (/Users/esteban/Projects/experiments/example1/node_modules/webpack/lib/NormalModule.js:327:30)
    at modules.forEach.m (/Users/esteban/Projects/experiments/example1/node_modules/webpack/lib/Chunk.js:253:31)
    at Array.forEach (native)
Run Code Online (Sandbox Code Playgroud)

我认为与webpack有关,但我不知道问题是什么或如何解决它.

重现它,就这样做

vue init webpack-simple example1
cd example1
npm i
npm i -S bulma vue-bulma-tabs
Run Code Online (Sandbox Code Playgroud)

然后将其添加到main.js文件中

import {Tabs, TabPane} from 'vue-bulma-tabs'
Run Code Online (Sandbox Code Playgroud)

然后运行

npm run dev
Run Code Online (Sandbox Code Playgroud)

etvoilà!有错误.我错过了什么?

Car*_*los 7

因此,此问题的根本原因是导致找不到您要导入的文件.有关解决方法的信息,请参阅https://github.com/webpack/webpack/issues/4072#issuecomment-278626604以添加一些日志记录,以帮助您查找无法导入的文件.


mcn*_*iac 1

我发现了这个问题,但我不确定是谁的错。

vue-bulma-tabs 使用不带 Vue 文件扩展名的导入。但 vue 的 webpack-simple 模板不支持这一点。

解决方案是配置 webpack 在解析键下的 webpack.config.js 上尝试 .vue 和 .js,添加

extensions: ['.js', '.vue']

现在正在工作。