New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TypeError: modules[moduleId] is undefined #660

Closed
kamov opened this Issue Nov 6, 2018 · 3 comments

Comments

Projects
None yet
2 participants
@kamov

kamov commented Nov 6, 2018

I am getting tihs error after run "npm run dev" on root of my project.

The modules installed at the moment don't have any JS or SCSS, all is still in root under resources/

I change the webpack.mix.js of root in this way (as suggested in docs):

const mix = require('laravel-mix');

/* ADDED custom for laravel-modules */
require('laravel-mix-merge-manifest');
mix.mergeManifest();

/// Autoload globally jquery
mix.autoload({
    'jquery': ['$', 'window.jQuery', 'jQuery'],
    //'tether': ['window.Tether', 'Tether'],
});


/// Application
mix.js('resources/js/main.js', 'public/js')
    .extract(['jquery', 'popper.js', 'bootstrap', 'select2']);


/// Main app.css
mix.sass('resources/sass/app.scss', 'public/css/app.css');

I am not sure what I missed, but I was not sure what you mean here:

"Mix is a configuration layer on top of Webpack, so to run your Mix tasks you only need to execute one of the NPM scripts that is included with the default laravel-modules package.json file"

Thanks

@kamov kamov closed this Nov 8, 2018

@kamov

This comment has been minimized.

kamov commented Nov 8, 2018

I was able to solve this

@nWidart

This comment has been minimized.

Owner

nWidart commented Nov 8, 2018

Can we know how?

@kamov

This comment has been minimized.

kamov commented Nov 9, 2018

For some reason the manifest.js file it's added under another folder, /js/pages and not under /js/vendor

I am not sure why, but loading manifest.js from /js/pages and not from /js/vendor worked fine.

So this error was generated when manifest.js was wrong.

In my code I load vendor to /js/vendor and then I load some specific js for pages like:

mix.js('resources/js/pages/admin-dashboard.js', 'public/js/pages/admin-dashboard.js')

Seem that mix create manifest.js on the last used folder or something like that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment