在 Sage 10 中导入模块的正确路径
Right path to import module in Sage 10
使用 Sage 10 WordPress Starter theme. I'm trying to import GLSL files this way:
// frontPage.js
import portalVertexShader from './shaders/front-page/portal/vertex.glsl'
这是文件结构:
但是我在控制台中得到类似路径错误的信息:
app.js?id=bba838275bfcabcf4aa4:37 Uncaught Error: Cannot find module './shaders/front-page/portal/vertex.glsl'
at webpackMissingModule (app.js?id=bba838275bfcabcf4aa4:37)
at Object../resources/scripts/frontPage.js (app.js?id=bba838275bfcabcf4aa4:37)
at __webpack_require__ ((index):304)
at Object../resources/scripts/app.js (app.js?id=bba838275bfcabcf4aa4:13)
at __webpack_require__ ((index):304)
at __webpack_exec__ (app.js?id=bba838275bfcabcf4aa4:90)
at app.js?id=bba838275bfcabcf4aa4:91
at Function.__webpack_require__.O ((index):340)
at app.js?id=bba838275bfcabcf4aa4:92
at webpackJsonpCallback ((index):425)
真不知道这是怎么回事。我怎样才能导入这些文件?谢谢!
我没安装 raw-loader
yarn add raw-loader --dev
使用 Sage 10 WordPress Starter theme. I'm trying to import GLSL files this way:
// frontPage.js
import portalVertexShader from './shaders/front-page/portal/vertex.glsl'
这是文件结构:
但是我在控制台中得到类似路径错误的信息:
app.js?id=bba838275bfcabcf4aa4:37 Uncaught Error: Cannot find module './shaders/front-page/portal/vertex.glsl'
at webpackMissingModule (app.js?id=bba838275bfcabcf4aa4:37)
at Object../resources/scripts/frontPage.js (app.js?id=bba838275bfcabcf4aa4:37)
at __webpack_require__ ((index):304)
at Object../resources/scripts/app.js (app.js?id=bba838275bfcabcf4aa4:13)
at __webpack_require__ ((index):304)
at __webpack_exec__ (app.js?id=bba838275bfcabcf4aa4:90)
at app.js?id=bba838275bfcabcf4aa4:91
at Function.__webpack_require__.O ((index):340)
at app.js?id=bba838275bfcabcf4aa4:92
at webpackJsonpCallback ((index):425)
真不知道这是怎么回事。我怎样才能导入这些文件?谢谢!
我没安装 raw-loader
yarn add raw-loader --dev