Webpack-Electron-React: Ошибка спасения ModuleConcatenation - PullRequest
0 голосов
/ 05 мая 2019

Я только начал создавать электронные настольные приложения с помощью ReactJ.Когда я запускаю приложение, я получаю это предупреждение о сборке веб-пакета.

       ModuleConcatenation bailout: Cannot concat with ./node_modules/@ant-design/create-react-context/lib/index.js (<- Module is not an ECMAScript module)
       ModuleConcatenation bailout: Cannot concat with ./node_modules/ant-design-palettes/lib/index.js (<- Module is not an ECMAScript module)
       ModuleConcatenation bailout: Cannot concat with ./node_modules/babel-runtime/helpers/classCallCheck.js (<- Module is not an ECMAScript module)
       ModuleConcatenation bailout: Cannot concat with ./node_modules/babel-runtime/helpers/createClass.js (<- Module is not an ECMAScript module)
       ModuleConcatenation bailout: Cannot concat with ./node_modules/babel-runtime/helpers/defineProperty.js (<- Module is not an ECMAScript module)
       ModuleConcatenation bailout: Cannot concat with ./node_modules/babel-runtime/helpers/extends.js (<- Module is not an ECMAScript module)
       ModuleConcatenation bailout: Cannot concat with ./node_modules/babel-runtime/helpers/inherits.js (<- Module is not an ECMAScript module)
       ModuleConcatenation bailout: Cannot concat with ./node_modules/babel-runtime/helpers/objectWithoutProperties.js (<- Module is not an ECMAScript module)
       ModuleConcatenation bailout: Cannot concat with ./node_modules/babel-runtime/helpers/possibleConstructorReturn.js (<- Module is not an ECMAScript module)
...

Вот моя конфигурация веб-пакета

const rpath = require("path")

module.exports = {
    entry: "./src/index.js",
    devtool:"source-map",
    output: {
        path: rpath.join(__dirname, "./dist"),
        filename: "bundle.js"
    },
    module:{
        rules:[
            {
                test: /\.(js|jsx)$/,
                exclude: /node_modules/,
                loaders: ["babel-loader"]
            },
            {
                test: /\.(css|scss)$/,
                exclude:/node_modules/,
                loaders: ["style-loader", "css-loader"]
            }
        ]
    },
    node: {
        __dirname: false,
        __filename: false
    },
    target: 'electron-renderer'
}

И моя конфигурация babel

{
    "presets": [["@babel/preset-env", {"modules":false}], ["@babel/preset-react"]],
    "plugins": ["transform-class-properties"]
}
Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...