DllPlugin预编译出错

ERROR in ./main/libs/dll/libiconv.so
Module parse failed: Unexpected character '' (1:0)
You may need an appropriate loader to handle this file type.
(Source code omitted for this binary file)
 @ dll myselflib

webpack.dll.js文件如下

const  webpack = require("webpack");
const path = require("path");

module.exports = {
    output: {
        path: path.join(__dirname, "../"),
        filename: '[name].js',
        library: '[name]'
       
    },
    entry: {
        myselflib: [
            path.join(__dirname, "../main/libs/dll/linkus_sdk.dylib"),
            path.join(__dirname, "../main/libs/dll/libcrypto.so"),
            path.join(__dirname, "../main/libs/dll/libiconv.so"),
            path.join(__dirname, "../main/libs/dll/libssl.so"),
            path.join(__dirname, "../main/libs/dll/libxml2.so"),
        ]
      },
      
    plugins: [
        new webpack.DllPlugin({
            path: path.join(__dirname, "../manifest.json"),
            name: '[name]',
            context: __dirname
          })
    ],     

};

运行 ./node_modules/.bin/webpack --config ./config/webpack.dll.js
然后一直报错,找不到原因

阅读 3.1k
1 个回答

webpack处理不了so文件,你这个是什么鬼,这里的dll不是linux系统里的dll。webpack只能处理前端能调用的文件

撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进
推荐问题