S
S
Sergey Zababurin2017-10-28 15:50:34
webpack
Sergey Zababurin, 2017-10-28 15:50:34

How to get data from php through webpack?

Good afternoon.
Installed php loader for webpack
index.js webpack.config.js
let fileContent = require('php!./index.php');

module.exports = {

module: {
loaders: [
  {
    test: /\.php$/,
    loaders: [
      'html-minify',
      'php-loader'
    ]
   },

 ]},
}

index.php
<?php
return print_r("test" );

Running webpack
ERROR in ./index.js
Module not found: Error: Can't resolve 'php' in
'C:\local\php'
@ ./index.js 6:18-44

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question