Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/node.js/35.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Node.js 如何让semantic/gulp/webpack在电子反应样板中工作_Node.js_Reactjs_Gulp_Webpack_Semantic Ui - Fatal编程技术网

Node.js 如何让semantic/gulp/webpack在电子反应样板中工作

Node.js 如何让semantic/gulp/webpack在电子反应样板中工作,node.js,reactjs,gulp,webpack,semantic-ui,Node.js,Reactjs,Gulp,Webpack,Semantic Ui,我正在尝试将react应用程序移植到electron,但我使用的是语义用户界面,它建议使用gulp进行设置。electron react样板文件使用webpack处理其所有包装,我无法让webpack+gulp工作,因此所有内容都将打包到electron应用程序中 我正在尝试,但我从网页包配置中收到“意外令牌导入”错误 B.法律改革委员会 { "presets": ["es2015", "stage-0", "react"], "plugins": ["add-module-export

我正在尝试将react应用程序移植到electron,但我使用的是语义用户界面,它建议使用gulp进行设置。electron react样板文件使用webpack处理其所有包装,我无法让webpack+gulp工作,因此所有内容都将打包到electron应用程序中

我正在尝试,但我从网页包配置中收到“意外令牌导入”错误

B.法律改革委员会

{
  "presets": ["es2015", "stage-0", "react"],
  "plugins": ["add-module-exports"],
  "env": {
    "production": {
      "presets": ["react-optimize"],
      "plugins": ["babel-plugin-dev-expression"]
    },
    "development": {
            "plugins": ["tcomb"],
      "presets": ["react-hmre"]
    },
    "test": {
      "plugins": [
        ["webpack-loaders", { "config": "webpack.config.test.js", "verbose":     false }]
      ]
    }
  }
}
简单的gulpfile.js直接来自上面的链接:

var gulp = require('gulp');
var webpack = require('webpack-stream');
gulp.task('default', function() {
  return gulp.src('src/entry.js')
    .pipe(webpack())
    .pipe(gulp.dest('dist/'));
});
网页包开发文件是

注意,一些名称在这个样板文件版本和我的项目之间发生了更改,但在其他方面是相同的

错误:

Configurator>gulp
[09:52:40] Using gulpfile C:\git\Configurator\gulpfile.js
[09:52:40] Starting 'default'...
[09:52:40] 'default' errored after 8.28 ms
[09:52:40] C:\git\Configurator\webpack.config.development.js:7
import webpack from 'webpack';
^^^^^^
SyntaxError: Unexpected token import
    at Object.exports.runInThisContext (vm.js:53:16)
    at Module._compile (module.js:513:28)
    at Object.Module._extensions..js (module.js:550:10)
    at Module.load (module.js:458:32)
    at tryModuleLoad (module.js:417:12)
    at Function.Module._load (module.js:409:3)
    at Module.require (module.js:468:17)
    at require (internal/module.js:20:19)
    at Gulp.<anonymous> (C:\git\Configurator\gulpfile.js:7:18)
    at module.exports     (C:\git\Configurator\node_modules\orchestrator\lib\runTask.js:34:7)
Configurator>gulp
[09:52:40]使用gulpfile C:\git\Configurator\gulpfile.js
[09:52:40]正在启动“默认”。。。
[09:52:40]“默认”在8.28毫秒后出错
[09:52:40]C:\git\Configurator\webpack.config.development.js:7
从“网页包”导入网页包;
^^^^^^
SyntaxError:意外的令牌导入
在Object.exports.runInThisContext(vm.js:53:16)
在模块处编译(Module.js:513:28)
在Object.Module._extensions..js(Module.js:550:10)
在Module.load(Module.js:458:32)
在tryModuleLoad时(module.js:417:12)
在Function.Module.\u加载(Module.js:409:3)
at Module.require(Module.js:468:17)
根据需要(内部/module.js:20:19)
狼吞虎咽。(C:\git\Configurator\gulpfile.js:7:18)
在module.exports(C:\git\Configurator\node\u modules\orchestrator\lib\runTask.js:34:7)
互联网告诉我,消除导入错误应该像在.babelrc中使用“es2015”预设一样简单,但它就在那里,没有任何帮助

我可以让dev服务器在electron应用程序中使用semantic ui内容,在semantic的初始gulp构建之后,但是由于某些原因,当我尝试打包安装程序以部署此东西时,它没有构建到electron包中

当我通过webpack运行electron app dev服务器时,它工作正常,但有两个错误:

无法设置未定义的属性导出

locals[0]似乎不是启用了热模块替换API的模块对象

后一个stacktrace可以追溯到我的一个react文件中的一些语义导入

我完全不知道如何让这些东西一起工作