There is a problem when jsx introduces a public js file in react.

1.weboack.config.js

{
    test: /\.js$/,
    exclude: /node_modules/,
    loader: "babel-loader",
    query: {
        presets: ["es2015", "babel"]
    }
},

2.common.js

var font={
    remFont:function(){
        alert(1)
    }
}
export default font

3.jsx

import font from "../common.js"

I wanted to introduce a public js file into the jsx file, but now the page error is

clipboard.png

what I found was that the babel in webpack.config was changed to babel-loader, but my webpack.config was babel-loader from the beginning. May I ask what caused this?

Mar.21,2021

configure parsing using babel core

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1ea2767-1bde.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1ea2767-1bde.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?