GithubHelp home page GithubHelp logo

donnikitos / vite-plugin-php Goto Github PK

View Code? Open in Web Editor NEW
25.0 25.0 0.0 212 KB

Vite's speed and tooling to preprocess PHP-files!

Home Page: https://www.npmjs.com/package/vite-plugin-php

License: MIT License

TypeScript 95.83% PHP 4.17%
php php-loader vite vite-loader vite-php vite-plugin vitejs

vite-plugin-php's People

Contributors

donnikitos avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

vite-plugin-php's Issues

Build watch does not reflect changes

Define vite build --watch in package.json on scripts:
image

Run the script

npm run watch

It keeps watching any change and rebuilds if it's so but it doesn't reflect anything new on the page after the first build.
It seems like the temp file does not update accordingly.

Should this be hot reloading automatically?

Hi, Should this be hot reloading automatically?

When I edit the index.php file the page does not hot reload automatically.
Vite output in CLI does notice the change and outputs this:

3:35:24 pm [vite] page reload src/index.php

Loading autoloader from vendor folder seems to interfere in dev server

System:
Linux Mint 21.2
LAMP server with Lando based in Docker.
PHP 8.1
Vite v4.5.0
Node v18.17.1

Running dev server

npm run dev

Loading autoloader from vendor folder:

/**
 * Autoloader.
 */
require_once __DIR__ . '/../vendor/autoload.php';

The page keeps reloading and never stops, so the page never appears to reflect changes.
I guess the plugin tries to escape this folder too, is there any way to ignore it?

The production build works fine though.

Support wildcards in entries

Hi, I'm trying wildcards and they don't work.

  plugins: [
    usePHP({
      entry: [
        "index.php",
        "partials/*.php",
      ]
    })
  ],

image

I have to define each file to make it work:

  plugins: [
    usePHP({
      entry: [
        "index.php",
        "partials/nav-top.php",
        "partials/message.php",
        "partials/footer.php",
      ]
    })
  ],

Is it possible to use wildcards in entries?

Thanks.

Import not working

When I use import in a PHP script to import another PHP script it doesn't work locally (it works after building though).

I have index.php:

<?php
    include '/config.php';
    echo $test
?>

and config.php:

<?php
    define("test", "testing");
?>

vite.config.ts:

import usePHP from 'vite-plugin-php';

export default defineConfig({
  plugins: [usePHP({ binary: '/opt/homebrew/bin/php', entry: ['index.php', 'config.php', 'get-access/index.php'],})],
});

When opening the page I get this error:

Warning: include(/config.php): Failed to open stream: No such file or directory in /Users/martinhell/Documents/quantumcode/slaice-website/node_modules/vite-plugin-php/dist/router.php(14) : eval()'d code on line 17

Warning: include(): Failed opening '/config.php' for inclusion (include_path='.:/opt/homebrew/Cellar/php/8.2.12_1/share/php/pear') in /Users/martinhell/Documents/quantumcode/slaice-website/node_modules/vite-plugin-php/dist/router.php(14) : eval()'d code on line 17

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.