在新的laravel 8應用程式中,我需要將字體更改為roboto和具有內容的檔案webpack.config.js:
const path = require('path');
module.exports = {
resolve: {
alias: {
'@': path.resolve('resources/js'),
},
},
};
我添加了幾行:
const path = require('path');
module.exports = {
resolve: {
alias: {
'@': path.resolve('resources/js'),
},
},
theme: {
extend: {
fontFamily: {
'roboto': ['Roboto'],
},
},
},
};
但是我在控制臺中遇到了錯誤:
$ npm run watch-poll
> @ watch-poll /project/Photographers
> mix watch -- --watch-options-poll=1000
[webpack-cli] Invalid configuration object. Webpack has been initialized using a configuration object that does not match the API schema.
- configuration has an unknown property 'theme'. These properties are valid:
object { amd?, bail?, cache?, context?, dependencies?, devServer?, devtool?, entry?, experiments?, externals?, externalsPresets?, externalsType?, ignoreWarnings?, infrastructureLogging?, loader?, mode?, module?, name?, node?, optimization?, output?, parallelism?, performance?, plugins?, profile?, recordsInputPath?, recordsOutputPath?, recordsPath?, resolve?, resolveLoader?, snapshot?, stats?, target?, watch?, watchOptions? }
-> Options object as provided by the user.
For typos: please correct them.
For loader options: webpack >= v2.0.0 no longer allows custom properties in configuration.
Loaders should be updated to allow passing options via loader options in module.rules.
Until loaders are updated one can use the LoaderOptionsPlugin to pass these options to the loader:
plugins: [
new webpack.LoaderOptionsPlugin({
// test: /\.xxx$/, // may apply this only for some modules
options: {
theme: …
}
})
]
npm ERR! code ELIFECYCLE
npm ERR! errno 2
npm ERR! @ watch-poll: `mix watch -- --watch-options-poll=1000`
npm ERR! Exit status 2
npm ERR!
npm ERR! Failed at the @ watch-poll script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! /home/user/.npm/_logs/2021-12-05T15_58_19_639Z-debug.log
我的語法錯了嗎?查看結構 webpack.config.js 我想它必須是有效的......
提前致謝!
uj5u.com熱心網友回復:
您需要在您的tailwind.config.js檔案而不是您的webpack.config.js檔案中更新它。
如果你沒有tailwind.config.js檔案,你可以通過運行來生成它:
npx tailwindcss init
或者(假設您沒有在檔案中指定組態檔的路徑webpack.mix.js),您可以tailwind.config.js在應用程式的根目錄中使用以下代碼創建:
module.exports = {
purge: [],
darkMode: false,
theme: {
extend: {
fontFamily: {
'roboto': ['Roboto'],
},
},
},
variants: {},
plugins: [],
}
轉載請註明出處,本文鏈接:https://www.uj5u.com/shujuku/377430.html
