Gatsby JS可以使用项目的父文件夹中的文件吗?

时间:2018-07-31 21:47:52

标签: babeljs gatsby

我正在建设两个项目;一种是在gatsbyjs中,另一种是使用react-native。我正在尝试通过导入import { UPDATE_USER_LOGIN } from '../../../shared-logic/queries';这样的文件来在两个项目之间共享应用程序逻辑 其中shared-logic是两个项目的父文件夹中的文件夹。具体来说,shared-logic是两个项目的同胞,并且包含两个项目应使用的业务逻辑。

不幸的是,当尝试使用gatsbydevelop命令启动我的gatsby网站时,出现以下错误:

Module build failed: ReferenceError: Unknown plugin "transform-regenerator" specified in "base" at 5, attempted to resolve relative to `"C:\\Users\\reggie\\Dropbox\\Project Avacado\\client-applications\\shared-logic\\Mocks"`

Mocks是导入的文件,如上例所示。从shared-logic目录导入的所有文件都遇到相同的错误
我想做的事可能吗? 预先感谢您的帮助。

完整错误的示例如下所示:

Module build failed: ReferenceError: Unknown plugin "transform-regenerator" specified in "base" at 5, attempted to resolve relative to "C:\\Users\\reggie\\Dropbox\\Project Avacado\\client-applications\\shared-logic"
    at C:\Users\reggie\Dropbox\Project Avacado\client-applications\web\node_modules\babel-core\lib\transformation\file\options\option-manager.js:180:17
    at Array.map (<anonymous>)
    at Function.normalisePlugins (C:\Users\reggie\Dropbox\Project Avacado\client-applications\web\node_modules\babel-core\lib\transformation\file\options\option-manager.js:158:20)
    at OptionManager.mergeOptions (C:\Users\reggie\Dropbox\Project Avacado\client-applications\web\node_modules\babel-core\lib\transformation\file\options\option-manager.js:234:36)
    at OptionManager.init (C:\Users\reggie\Dropbox\Project Avacado\client-applications\web\node_modules\babel-core\lib\transformation\file\options\option-manager.js:368:12)
    at File.initOptions (C:\Users\reggie\Dropbox\Project Avacado\client-applications\web\node_modules\babel-core\lib\transformation\file\index.js:212:65)
    at new File (C:\Users\reggie\Dropbox\Project Avacado\client-applications\web\node_modules\babel-core\lib\transformation\file\index.js:135:24)
    at Pipeline.transform (C:\Users\reggie\Dropbox\Project Avacado\client-applications\web\node_modules\babel-core\lib\transformation\pipeline.js:46:16)
    at transpile (C:\Users\reggie\Dropbox\Project Avacado\client-applications\web\node_modules\babel-loader\lib\index.js:46:20)
    at C:\Users\reggie\Dropbox\Project Avacado\client-applications\web\node_modules\babel-loader\lib\fs-cache.js:79:18
    at ReadFileContext.callback (C:\Users\reggie\Dropbox\Project Avacado\client-applications\web\node_modules\babel-loader\lib\fs-cache.js:15:14)
    at FSReqWrap.readFileAfterOpen [as oncomplete] (fs.js:434:13)

0 个答案:

没有答案