Font awesome doesn't work with webpack and cordova

I installed font-awesome-webpack via npm in my Cordova project. I use webpack to create a bundle.js file in my / www folder. For fonts to work, I also need to create font-awesome-files in this folder. My wepack.config.js file:

module.exports = { devtool: 'source-map', entry: { app: ["./src/main.jsx"] }, output: { path: path.resolve(__dirname, "dist/cwebphone/www"), publicPath: "http://localhost:8088/", filename: "bundle.js" }, plugins: [ new webpack.HotModuleReplacementPlugin(), new webpack.NoErrorsPlugin() ], module: { loaders: [{ test: /\.js?$/, loaders: ['react-hot', 'babel'], exclude: /node_modules/, include: __dirname }, { test: /\.less$/, loader: 'style-loader!css-loader!less-loader' }, { test: /\.css$/, loader: 'style-loader!css-loader' }, { test: /\.png$/, loader: "url-loader", query: { mimetype: "image/png"}}, { test: /\.woff(2)?(\?v=[0-9]\.[0-9]\.[0-9])?$/, loader: "url-loader?limit=10000&minetype=application/font-woff" }, { test: /\.(otf|ttf|eot|svg)(\?v=[0-9]\.[0-9]\.[0-9])?$/, loader: "file-loader" }, { test: /\.jsx$/, loaders: ['react-hot', 'babel'], exclude: /node_modules/, include: __dirname } ] } }; 

In my main.jsx, I have this for Font-awesome-webpack:

 require("font-awesome-webpack!../node_modules/font-awesome-webpack/font-awesome.config.js"); 

The generated files are a .woff, .woff2, .svg, .eot, and .ttf file. The font-awesome folder also contains one otf file that is not created. Does anyone know what I am missing to get this to work?

+5
source share

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


All Articles