I'm working on a Symfony 4 project with Webpack Encore for asset management. I configured my local server with this : https://stackoverflow.com/a/15864222/5158153
I can access to localhost from my Android device but it doesn't get access to any asset. I tried with another project (not Symfony) and it can get assets.
I think there's something I forgot with webpack config but I don't know what.
Webpack-config.js
const Encore = require('@symfony/webpack-encore');
Encore
.setOutputPath('public/build/')
.setPublicPath('http://localhost/tharmo/public/build')
.setManifestKeyPrefix('build/')
.cleanupOutputBeforeBuild()
.enableSourceMaps(!Encore.isProduction())
.autoProvidejQuery()
.createSharedEntry('vendor', [
'./assets/js/custom.js',
'materialize-css',
])
.addEntry('app', './assets/js/app.js')
.enableSassLoader()
;
module.exports = Encore.getWebpackConfig();
base.html.twig
<link type="text/css" rel="stylesheet" href="{{ asset('build/app.css') }}"
media="screen,projection" />
It works correctly in Windows where Wamp server is installed but not in Android. On Android device, if I type the url, I can get the asset so something is wrong with the way I get asset in Twig.