Я использую Webpack Encore с проектом Symfony 4. Bootstrap работает, если я запускаю php bin / console server: запускаю и я захожу на http://127.0.0.1:8000
Но, когда я запускаю Apache, чтобы использовать ссылку http://localhost/show-my-pictures/public/index.php Bootstrapперестать функционировать. И разработчик консоли дает мне:
The script from “http://localhost/build/runtime.js” was loaded even though its MIME type (“text/html”) is not a valid JavaScript MIME type.
Я не понимаю, что происходит. Можете ли вы помочь мне, пожалуйста?
Webpack.config.js
var Encore = require('@symfony/webpack-encore');
var CopyWebpackPlugin = require('copy-webpack-plugin'); // this line tell to webpack to use the plugin
Encore
// directory where compiled assets will be stored
.setOutputPath('public/build/')
// public path used by the web server to access the output path
.setPublicPath('/build')
/*
* ENTRY CONFIG
*
* Add 1 entry for each "page" of your app
* (including one that's included on every page - e.g. "app")
*
* Each entry will result in one JavaScript file (e.g. app.js)
* and one CSS file (e.g. app.css) if you JavaScript imports CSS.
*/
.addEntry('app', './assets/js/app.js')
/*
* FEATURE CONFIG
*
* Enable & configure other features below. For a full
* list of features, see:
* https://symfony.com/doc/current/frontend.html#adding-more-features
*/
.cleanupOutputBeforeBuild()
.enableBuildNotifications()
.enableSourceMaps(!Encore.isProduction())
.enableSingleRuntimeChunk()
// enables hashed filenames (e.g. app.abc123.css)
.enableVersioning(Encore.isProduction())
// enables Sass/SCSS support
.enableSassLoader()
// uncomment if you're having problems with a jQuery plugin
.autoProvidejQuery()
.addPlugin(new CopyWebpackPlugin([
{ from: './assets/images', to: 'images' }
]))
;
module.exports = Encore.getWebpackConfig();