Comments (12)
I'm not 100% sure what semantic ui needs from the provide plugin but you can use it like this:
In your nuxt.config.js
const webpack = require('webpack')
module.exports = {
build: {
plugins: [
new webpack.ProvidePlugin({
'$': 'jquery',
'_': 'lodash'
// ...etc.
})
]
}
}
from nuxt.js.
@dan-gamble doesn't work to me... with what versión works?
from nuxt.js.
Hi,
I'm also having this issue. npm run dev
gives me
ERROR
Error: TypeError [ERR_INVALID_ARG_TYPE]: The "path" argument must be of type s tring
- path.js:28 assertPath
path.js:28:11
- path.js:1469 extname
path.js:1469:5
- builder.js:71 _.uniqBy.options.plugins.map
[cve-miner-gui]/[nuxt]/lib/builder/builder.js:71:48
- Array.map
- builder.js:69 Builder.get plugins [as plugins]
[cve-miner-gui]/[nuxt]/lib/builder/builder.js:69:28
- builder.js:256 Builder.generateRoutesAndFiles
[cve-miner-gui]/[nuxt]/lib/builder/builder.js:256:21
- builder.js:165 Builder.build
[cve-miner-gui]/[nuxt]/lib/builder/builder.js:165:16
What I've done in nuxt.config.js
:
const webpack = require('webpack')
module.exports = {
[...]
plugins: [
{ src: '~plugins/myOtherPlugin.js', ssr: false },
new webpack.ProvidePlugin({
'$': 'jquery',
})
],
[...]
On top of that, the Nuxt.js FAQ page is at odds with the API docs:
- FAQ: How to add webpack plugins? describes exactly what I'm doing, but
- API: The plugins Property states that entries to the
plugins
array can only be ofString
or{ src: String, ssr: Boolean }
type.
Bottom line: I think the documentation on the FAQ page is out of date, but I cannot figure out how to solve the problem.
from nuxt.js.
Philcal, I just noticed something!
I placed the webpack.ProvidePlugin
in
module.exports = {
plugins: [ /* here */ ]
}
whereas it should probably be in
module.exports = {
plugins: [ /* not here */ ],
build: {
plugins: [ /* but here! */ ]
}
}
An example can be found in this issue: #1319 .
On top of that, the FAQ page I mentioned earlier also states this. I think I just missed that it should be an a different plugins
array and thus used it wrongly. You may be doing the same?
hth
from nuxt.js.
@tsvetant can you confirm it's working?
from nuxt.js.
Yes, it worked ! I just needed to put the jquery to get semantic-ui to work without extra effort
from nuxt.js.
@tsvetowntopalov how do you include semantic ui to nuxt?
from nuxt.js.
Did you find a solution to this problem?
from nuxt.js.
No, I did not.
I needed JQuery, and ended up doing this in my component:
mounted () {
if (process.browser) {
let { $ } = window
$(window).scroll(function () {
if ($(this).scrollTop() > 100) {
$('#back-to-top').fadeIn()
} else {
$('#back-to-top').fadeOut()
}
})
}
}
...along with this in my layout:
head: {
script: [
{ src: '/js/jquery-3.2.1.min.js' }
]
}
You may be able to solve your problem in a similar fashion :)
from nuxt.js.
@philcal I investigated the issue further.
The solution suggested in the FAQ works as expected.
The problem was caused by Eslint, namely error '$' is not defined no-undef
. You can quickly check if this is the problem by amending the rules in your .eslintrc.js
file: 'no-unreachable': 'warn'
. Then, it should work.
If you want to keep things clean, I suggest you try to merge the eslint config from a newer version of Nuxt, where this webpack stuff works out of the box :)
from nuxt.js.
module.exports = {
build: {
plugins: [
new webpack.ProvidePlugin({
'$': 'jquery',
'_': 'lodash'
// ...etc.
})
]
}
}
Looks like it will inject jquery, lodash at every page. Am I right?
from nuxt.js.
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.
from nuxt.js.
Related Issues (20)
- Failed to resolve entry for package "crypto"/"zlib" HOT 4
- /user/ redirect to /user HOT 2
- Running logic post prerender HOT 2
- Deploys to netlify break after upgrading to 3.6.x HOT 2
- The CPU has been soaring, even in the middle of the night
- Separate the prerendering step from the build step HOT 2
- Allow defining type for getQuery() function via generic HOT 1
- Allowing more than a single fetch in useAsyncData HOT 8
- Missmatch nuxt version when package-lock is missing HOT 3
- Unclear what is Nuxt’s default build target HOT 2
- Static deployed nuxt 3 application still does not let me navigate HOT 1
- allow disabling JS in development mode as well as production HOT 3
- `nuxt.options.watch` not restarting dev server HOT 1
- middleware works only with import and no strings in definePageMeta HOT 2
- cdnURL from nuxt.config.ts doesnt show up in nuxt.options.app property in a module HOT 3
- Nuxt fails to load urls on linked module HOT 8
- The cache on the Cloudflare page does not expire HOT 1
- Client-only components cannot access `this` in the render function HOT 1
- Manually Typed RuntimeConfig inside Layer causes TypeScript error in app using this layer. HOT 2
- Retry import / chunk / CSS loads for transient network errors HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from nuxt.js.