Chapters
48 Chapters
|
5:05:52
|
Login to bookmark this video
-
Course Code
Subscribe to download the code!
Subscribe to download the code!
-
This Video
Subscribe to download the video!
Subscribe to download the video!
-
Subtitles
Subscribe to download the subtitles!
Subscribe to download the subtitles!
-
Course Script
Subscribe to download the script!
Subscribe to download the script!
02.
Installing Vue, Webpack & Eslint
Scroll down to the script below, click on any sentence (including terminal blocks) to jump to that spot in the video!
Subscribe to jump to this part in the video!
This course is also built to work with Vue 3!
What JavaScript libraries does this tutorial use?
// package.json
{
"devDependencies": {
"@symfony/webpack-encore": "^0.30.0", // 0.30.2
"axios": "^0.19.2", // 0.19.2
"bootstrap": "^4.4.1", // 4.5.0
"core-js": "^3.0.0", // 3.6.5
"eslint": "^6.7.2", // 6.8.0
"eslint-config-airbnb-base": "^14.0.0", // 14.1.0
"eslint-plugin-import": "^2.19.1", // 2.20.2
"eslint-plugin-vue": "^6.0.1", // 6.2.2
"regenerator-runtime": "^0.13.2", // 0.13.5
"sass": "^1.29.0", // 1.29.0
"sass-loader": "^8.0.0", // 8.0.2
"vue": "^2.6.11", // 2.6.11
"vue-loader": "^15.9.1", // 15.9.2
"vue-template-compiler": "^2.6.11", // 2.6.11
"webpack-notifier": "^1.6.0" // 1.8.0
}
}
18 Comments
If like me you get JS warnings because some feature flags are "not explicitly defined", you can add them to the config this way:
Hey ThibautPalma,
Thank you for sharing this tip with others!
Cheers!
Hello and thank you for this tutorial. About the eslint config file, I have already placed it inide the root dir of my app. Given that I am using the vscode, and that I have already installed the eslint extension, how can I tell vscode to look into the external eslint config file? Thank you.
Hey Ali,
We all use PhpStrom in SymfonyCasts, so I'm not sure how to configure it in VSCode in particular, you probably better google it, I bet there should be an answer about it in the internet. Otherwise, try to look at the VSCode/plugin configuration, I think there should be something obvious there.
Cheers!
I'm not sure what's updated but since a couple of days ago I don't think it's enough to install
yarn add vue@^2.5 vue-loader@^15 vue-template-compiler --dev
it was necessary for me to install
"@vue/compiler-sfc"
Hi Sasa!
Can you post here what error did you get and what version of Vue was actually installed (i.e. package.json)?
If I understand correctly, Vue 2 uses vue-loader version 15 and vue-template-compiler, while Vue 3 uses vue-loader version 16 and @vue/compiler-sfc. It looks like you've installed Vue 3!
For me It is not worked even with fresh copy of symfony and webpack (this documentation https://symfony.com/doc/current/frontend/encore/vuejs.html)
If you do
<blockquote>
yarn list vue</blockquote>What do you see?
If you have Vue 3.x installed, then vue-template-compiler won't work!
vue@2.6.14
Hrmm... I'm not sure what the problem might be then. Vue 2.6.x *should* work with vue-loader and vue-template-compiler. What error messages do you get when trying to run yarn watch?
I have the same problem - it doesnt work with vue version 3.3.4 ... any solutions so far?
EDIT: i solved the problem (for me) by replacing
.enableVueLoader(() => {}, {version: 3})with.enableVueLoader().But I then still install vue version 3 with
npm i vue[at]next vue-loader[at]next --save-devThis solved the problem for me so far - I will do some more tests with that setup ...
Hey @Christian!
That's super weird that this would make a difference, but if it works, it should be good! That version stuff controls exactly how the loader is hooked up in Encore... and it should either not work at all, or work. So if it's building, I bet you will be ok :).
Cheers - and thanks for posting what worked for you.
where do we get the .eslintrc from?
Hey there,
If you download the course code from this page you can get it from it or, you can search for a template file like this one (and tweak it to your needs) https://gist.github.com/adr...
Cheers!
Hello ! Thanks for the tutorial it is helping me a lot to optimize my default Symfony/VueJs base. I now have the HMR working nicely however when I go into production mode and run
yarn buildI get some MiniCssExtract plugin errors I can't find a solution for (for the last couple of hours ...)I find something like :
when running with yarn build --verbose. I have seen a couple a of github issues and stack overflow questions that seem to say you need to use
requireand notimportin the typescript files but this seems like something that is not the problem anymore.Some reckon that the
Breaks stuff when you import with
@import ~styles/variablesinstead of just@import variables(some even say that it's without ending with .scss that it breaks ...)On other once I have read that the MiniCssExtractPlugin needs the esModule option set to false ...
All this to say I have looked everywhere and tried all of the above but I might be completely missing something.
This is probably not much information to work with and not a lovely question but any hints will be greatly appreciated ;)
Thanks for all the courses !
Hi Denis!
It's hard to know what the issue would be given the information provided. Since the issue is SCSS related, I don't think this would have anything to do with TypeScript. Are your packages up to date? Are you referring to our tutorial or your own project? Have you tried upgrading the packages and removing the localIdentName config entry in the webpack.config.js file? Are you running the production script in your same local environment or have you checked the repo out in a production server? Remember "dev" packages won't install if your env is "production". In this case, the idea is that you bluild your production files locally and then commit them, so you don't have to download and do complex stuff in the prod server.
May be you can give us some more info?
Hi thanks for the help, I'm sorry to only reply now, I never see disqus notifications, something I have to work on aswell.
It is based on the tutorial but my dev environment always runs with docker-compose.yml, alpine based images and traefik to get everything to communicate.
The packages are upto date, maybe I'm missing an apk on alpine node but I can't see anything that points me in that direction.
My packages are in dev locally and in production gitlab-ci builds them and rsyncs them to the /public/build. I can't see any depencies that minicssextract would need that are not in the correct part of the package.json
Stuff works now but still brings up some errors. Anyway thanks for your reply it's not something urgent for me
Hey DennisdeBest!
Hmm. Let's simplify a little bit :). On your dev locally, if you run
yarn encore productionand then try it, do you see the error? I want to rule out that the hold gitlab-ci & rsync process isn't part of the problem (I can't think why it would be, but we need to eliminate it).Cheers!
"Houston: no signs of life"
Start the conversation!