@pc579 check folder or file path. ../ depend on file location you writing import "../api". Use @ which is alias for path resources/js.
Nov 2, 2022
6
Level 1
Webpack / Mix - how to change a script directory?
I get the error "Can't resolve '../api" running "npm run dev"
I wrote a script to retrieve some data via an api call.
This script works well when I put it in the vendor directory (vendor/badaso/core/src/js/api/modules) It is called by a store in resources/js/badaso/stores with
import api from "../../../../vendor/badaso/core/src/resources/js/api";
When I move this script to resources/js/badaso/api/modules and call it by
import "../api"
Running "npm run dev", I get the error
Can't resolve '../api
My webpack.mix.js is
const mix = require('laravel-mix');
//mix.js('resources/js/app.js', 'public/js') // original
mix.js('resources/js/*.js', 'public/js') // try -> same error
.postCss('resources/css/app.css', 'public/css', [
//
]);
// Can't resolve '../api'
// Badaso
mix.js("vendor/badaso/core/src/resources/js/app.js", "public/js/badaso.js")
.sass("vendor/badaso/core/src/resources/js/assets/scss/style.scss", "public/css/badaso.css")
.vue()
Thanks in advance for any help
Please or to participate in this conversation.