天天看點

vue項目中webpack打包glsl檔案不能編譯,You may need an appropriate loader to handle this file type

報錯内容如下

You may need an appropriate loader to handle this file type, currently no loaders are configured to process this file.

vue項目中webpack打包glsl檔案不能編譯,You may need an appropriate loader to handle this file type

最近跟着學了下three的着色器,編寫的GLSL檔案,編譯的時候報錯,看意思可能是缺少loader,苦于不知道是那個loader,一番百度查詢到的,在此記錄一下

1、

npm install --save-dev webpack-glsl-loader

安裝webpack-glsl-loader

2、修改vue.config.js配置,添加内容如下

configureWebpack: (config) => {
    config.module.rules.push({
      test: /\.glsl$/,

      use: [
        {
          loader: "webpack-glsl-loader",
        },
      ],
    });
  },
           

3、重新

npm run serve

繼續閱讀