Code Monkey home page Code Monkey logo

laravel-mix-twig's People

Contributors

dependabot[bot] avatar gsusg avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

laravel-mix-twig's Issues

How to use with BrowserSync

Currently, my Twig gets compiled to HTML correctly πŸ™Œ
Magically, the JS is linked in the header, but the path is incorrect. 😞
I get Failed to load resource: net::ERR_NAME_NOT_RESOLVED as the path //app.js gets resolved to http://app.js which is not valid.

Here is my mix.config.js

// webpack.mix.js
let mix = require("laravel-mix");
require("laravel-mix-twig");

mix
  .twig({
    enabled: !mix.inProduction(),
    root: "src/views/",
    output: ".",
  })
  .js("src/js/app.js", "dist")
  .browserSync({
    server: "dist",
  })
  .setPublicPath("dist");

Here is my directory structure:
Capture d’écran, le 2022-06-14 aΜ€ 14 00 55

Error: Cannot read property 'length' of undefined

I'm getting the following error when changing the output config setting.

[webpack-cli] TypeError: Cannot read property 'length' of undefined
    at /Users/kylebrumm/projects/laravel-mix-with-twig/node_modules/laravel-mix-twig/src/index.js:146:55
    at Array.forEach (<anonymous>)
    at makeHtmlConfig (/Users/kylebrumm/projects/laravel-mix-with-twig/node_modules/laravel-mix-twig/src/index.js:138:25)
    at Twig.webpackPlugins (/Users/kylebrumm/projects/laravel-mix-with-twig/node_modules/laravel-mix-twig/src/index.js:165:13)
    at ComponentRegistrar.applyPlugins (/Users/kylebrumm/projects/laravel-mix-with-twig/node_modules/laravel-mix/src/components/ComponentRegistrar.js:203:23)
    at /Users/kylebrumm/projects/laravel-mix-with-twig/node_modules/laravel-mix/src/components/ComponentRegistrar.js:102:50
    at /Users/kylebrumm/projects/laravel-mix-with-twig/node_modules/laravel-mix/src/Dispatcher.js:37:62
    at Array.map (<anonymous>)
    at Dispatcher.fire (/Users/kylebrumm/projects/laravel-mix-with-twig/node_modules/laravel-mix/src/Dispatcher.js:37:47)
    at Mix.dispatch (/Users/kylebrumm/projects/laravel-mix-with-twig/node_modules/laravel-mix/src/Mix.js:240:32)
error Command failed with exit code 2.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.