How to get semantic / gulp / webpack to work in an electronic reaction scheme

I am trying to port the application to electron using electron-react-boilerplate , but I am using semantic-ui, which I suggested setting up with gulp. The electron-reaction tile uses webpack to process all its packaging, and I cannot get webpack + gulp to work, so everything will be packaged in an electronic application.

I am trying this link, which explains how to handle the webpack configuration through gulp tasks , but I get an "unexpected token" import "from the webpack configuration.

.babelrc

{
  "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 }]
      ]
    }
  }
}

simple gulpfile.js directly from the link above:

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/'));
});

dev webpack file here ,

, , .

:

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)

, , "es2015" .babelrc, .

dev- gulp , - , .

- webpack, , :

cannot set property exports of undefined

locals[0] does not appear to be a module object with hot module replacement API enabled

stacktrace .

, .

+4

Source: https://habr.com/ru/post/1663760/


All Articles