-
-
Notifications
You must be signed in to change notification settings - Fork 3.9k
and design vue with nuxt js 2 less loader problem #234
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
you can import less with nuxt.config.js
if you has used babel-plugin-imort , you should remove
|
i'm not using babel-plugin-import, I have try to import less: css: [ with build config in nuxt.config: build: {
} but I got this error: Module build failed (from ./node_modules/less-loader/dist/cjs.js): // ant-design/ant-motion#44 .bezierEasingMixin(); ^ Inline JavaScript is not enabled. Is it set in your options? in /Applications/XAMPP/xamppfiles/htdocs/auth/node_modules/ant-design-vue/lib/style/color/bezierEasing.less (line 110, column 0) I wonder why javascriptEnabled: true not working |
nuxt.config.js:
It works... |
if there is any new response for this issue? |
Downgrade Less to: ^2.7.3 |
The bellow config works for me: nuxt.config.js
Plugins/antd-ui.js
package.json
|
@ibelem Your code snippets worked for me. I likely was having different issue than what others were describing above, but just because I didn't comprehend what loader/preprocessor was being used based off of Nuxt's config.js css value, and this made the less-loader modifyVar options I was setting useless. It appears that when we use Nuxt's default create-nuxt-app with ant-design selected as the ui component lib, the Nuxt.config.js that is generated has css: ['ant-design-vue/dist/antd.css'] as the value. According to Nuxt documentation for Nuxt.config.js, Nuxt will guess what preprocessor is needed based on that string value here. (In this case, none will be needed for a .css file, so even if we set Loader options and use modifyVars, we never use less-loader to set our global css styles, so there is nothing trying to override them.) However, I guess since the way we override global theme values with antd is by using less-loader options, we have to make sure we're pre-processing with less-loader so that Webpack/less-loader can do it's thing with modifyVars option. Had to change from the generate string, to this snippet here: And my less-loader modifyVars options began working. Had some trouble with this because Nuxt let's me kind of not worry about the details of preprocessing or webpack loader behavior during build steps. This might be an opportunity for create-nuxt-app to default to a configuration that enables you to override the default themes set by antd, idk. |
I create a project based on vue-cli 3, and add ant-design-vue. Then I got this error, and downgrade Less works... |
I still do have this problem, on It is on my nuxt and I do have also a SASS on my project. |
The less options have changed. This may help: build: {
/*
** You can extend webpack config here
*/
extend(config, ctx) {},
loaders: {
less: {
lessOptions: {
javascriptEnabled: true,
modifyVars: {
'primary-color': 'rgba(222, 12, 101, 1.0)',
'component-background': '#ffffff'
}
}
}
}
} |
This one worked for me. Thanks @LikeCarter ! |
This issue is stale because it has been open 60 days with no activity. Remove stale label or comment or this will be closed in 7 days |
checking current version of Nuxt and Ant, this versions works (just check package.json of your Ant installation in node_modules):
|
This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
What problem does this feature solve?
I'm using nuxt and-design-vue with nuxt by using chen-yan guide on support nuxt.js #146 ticket. However ant-design-vue less loader unable to load in the latest version of nuxt 2. with this problem:
× error \node_modules\ant-design-vue\dist\antd.less:1 (function (exports, require, module, __filename, __dirname) { @import "../lib/style/index.less"; ^ SyntaxError: Invalid or unexpected token
is it problem with webpack 4?
What does the proposed API look like?
i try to find solution but still not working.
The text was updated successfully, but these errors were encountered: