我很难提取一个文件/路径,所以它会被放入vendor.js中。我目前使用的代码片段是:
mix.js('resources/assets/js/frontend.js', 'public/js')
.extract([
'jquery',
'bootstrap',
'../resources/assets/vendor/constellation.min.js'
])我收到的错误是:
ERROR Failed to compile with 1 errors 2:14:34 PM
This relative module was not found:
* ../resources/assets/vendor/constellation.min.js in multi jquery bootstrap ../resources/assets/vendor/constellation.min.js文件constellation.min.js位于resources/assets/vendor/constellation.min.js中。我怎样才能正确引用它?
发布于 2017-06-13 16:07:01
使用文件结构时,./通常用于表示“当前目录”。
由于laravel目录位于项目目录的根目录,因此我们需要沿着正确的路径走出根:
./resources/assets/vendor/constellation.min.js因此,我们可以在mix.js中使用:
mix.js('resources/assets/js/frontend.js', 'public/js')
.extract([
'jquery',
'bootstrap',
'./resources/assets/vendor/constellation.min.js'
])希望这能有所帮助!
发布于 2020-09-21 13:08:17
我以同样的方式提取了swiper定制构建:
.extract([path.resolve(__dirname, '../resources/assets/js/vendor/swiper-bundle.min.js')],'libs/swiper.js')但随后我注意到,我的入口入口点也包含了它的代码。因此,我只是不需要重复代码。因此,我回到了从node_modules中提取库的问题。小心点。
https://stackoverflow.com/questions/44508960
复制相似问题