Closed dmitryshelomanov closed 2 years ago
Just refer to them in css. Need more info.
@fivethreeo connected via stylus razzle have assets loaders?
If you use css loader it should load any url() in css via file loader
So set PUBLIC_PATH to static url during build or set it to / to make it relative to the css file
@fivethreeo can you provide example ? current styl enhancer
fonts builded incorrect public/hash.ttf (module.export inside) css contains link to hash above and public/media -> real font
can i use media/font after build ?
browser cant parse it
You need to add styl to fileLoaderExclude in modifyWebpackOptions
module.exports = {
modifyWebpackOptions({
options: {
webpackOptions, // the modified options that will be used to configure webpack/ webpack loaders and plugins
},
}) {
webpackOptions.fileLoaderExclude.push(/\.styl$/)
return webpackOptions;
},
};
@fivethreeo already
yeah, sure, i have the same issue with fonts
webpack version?
5.64.2
but it works actually fine with custom webpack
using file-loader in custom?
ok, i try it
Webpack5 recommends asset modules, but no support in razzle as of yet. But file-loader should still work.
@fivethreeo https://codesandbox.io/s/intelligent-grass-chm3z?file=/src/App.js demo
added stylus to modifyWebpackConfig
added styl to fileLoaderExclude
but st compiled not as module (its locally work fine)
@fivethreeo and now static now from dev server (3001)
In dev media is on 3001
yes, after modify env - all static watching for /
it still the same after running prod build
needs mini css extract aswell
On Tue, 23 Nov 2021 at 16:01, Shelomanov Dmitry @.***> wrote:
it still the same after running prod build
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/jaredpalmer/razzle/issues/1765#issuecomment-976675050, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAAADGQTXDHMBZTX4Q3Q5ELUNOUENANCNFSM5ISDLW4Q .
-- Øyvind Saltvik
i just wanna fix that fonts is loading incorrectly, finally we have this instead of font itself, so browser can't parse it
loading fonts via url() in stylus work incorrectly, the problem is about the processing of url
i did it CLIENT_PUBLIC_PATH=/ PUBLIC_PATH=/ broket dev server
i try to go back on "webpack": "^4.44.1", css-loader style-loader stylus-loader
its work
but new problem - Error module not found : cannot resolve swiper/react
webpack 5 and razzle still not working ? @fivethreeo
Lots of conflicting modules and conf between 4 and 5. Really want separate razzle plugins per webpack version.
Make sure swiper is transpiled. https://razzlejs.org/docs/customization#transpilation-of-external-modules
i did it with webpack 5 and now i have same razzle config with webpack 4 its not working
wp5 has better esmodule support
CLIENT_PUBLIC_PATH is only for dev so no need to change
with CLIENT_PUBLIC_PATH=/ static has url /path (not localhost:3001/path)
btw, using yarn or npm?
npm
i always use yarn, codesandbox does too, not sure if it matters
example above works fine problem was in esModule: false, ? now i can upgrade webpack to 5 ?
seems so
@fivethreeo thanks I can start with webpack 5 (npm install --force) and normaly with webpack 4
fonts included
module.exports = __webpack_public_path__ + "link-to-media-fonts";
browser cannot parse it
how to fix ?
(media contains normal ttf font and etc types)