I got an error with trying to compile css
Module build failed (from ./node_modules/postcss-loader/dist/cjs.js):
TypeError: Cannot read properties of undefined (reading 'syntax')
Here is like the main css file looks looks like.
/**
* This injects Tailwind's base styles and any base styles registered by
* plugins.
*/
#import "tailwindcss/base";
/**
* Application styles
*/
/* Shared/Global */
#import "./shared/fonts.css";
#import "./shared/typography.css";
#import "./shared/global.css";
#import "./shared/grid.css";
#import './shared/vue-transitions.css';
#import './shared/cards.css';
#import './shared/forms.css';
#import './shared/pages.css';
/* Vendors */
#import "./vendors/simplebar.css";
#import "./vendors/vue-scrollbar.css";
/* Components */
#import "./components/button.css";
#import "./components/rte.css";
#import "./components/footer.css";
#import "./components/social-buttons.css";
#import "./components/navbar.css";
#import "./components/header.css";
#import "./components/breadcrumbs.css";
#import "./components/content-nav.css";
#import "./components/text.css";
#import "./components/text-image.css";
#import "./components/card.css";
#import "./components/crops.css";
#import './components/search-bar.css';
#import './components/custom-select.css';
#import './components/modal.css';
#import "./components/login.css";
#import "./components/download.css";
/**
* This injects Tailwind's component classes and any component classes
* registered by plugins.
*/
#import "tailwindcss/components";
/**
* This injects Tailwind's utility classes and any utility classes registered
* by plugins.
*/
#import "tailwindcss/utilities";
/**
* Use this directive to control where Tailwind injects the responsive
* variations of each utility.
*
* If omitted, Tailwind will append these classes to the very end of
* your stylesheet by default.
*/
#import "tailwindcss/screens";
what is strange compiler goes ok when all the imports except tailwind ones are commented. So this is definitely some issue with the css import.
and here package.json for some reference what is used in the project
{
"name": "sg",
"version": "1.0.0",
"description": "sg",
"main": "src/main.js",
"private": true,
"scripts": {
"start": "cross-env NODE_ENV=development webpack-dev-server --open",
"startproxy": "cross-env webpack-dev-server --open --mode development --env.development --env.useProxy --env.proxyUrl",
"build": "cross-env NODE_ENV=build webpack",
"publish": "cross-env NODE_ENV=publish webpack",
"test": "jest"
},
"keywords": [],
"author": "TC",
"devDependencies": {
"#babel/core": "^7.11.4",
"#babel/preset-env": "^7.11.0",
"#vue/babel-preset-app": "^4.5.4",
"#vue/test-utils": "^1.0.4",
"autoprefixer": "^10.0.2",
"axios": "^0.23.0",
"babel-core": "^7.0.0-bridge.0",
"babel-jest": "^25.5.1",
"babel-loader": "^7.1.5",
"clean-webpack-plugin": "^1.0.0",
"copy-webpack-plugin": "^5.1.0",
"cross-env": "^6.0.3",
"css-loader": "^1.0.1",
"cssnano": "^4.1.10",
"dotenv-webpack": "^1.8.0",
"eslint": "^5.10.0",
"eslint-config-standard": "^12.0.0",
"eslint-friendly-formatter": "^4.0.1",
"eslint-loader": "^2.1.1",
"eslint-plugin-import": "^2.25.2",
"eslint-plugin-node": "^8.0.0",
"eslint-plugin-promise": "^4.0.1",
"eslint-plugin-standard": "^4.0.0",
"eslint-plugin-vue": "^5.2.2",
"file-loader": "^2.0.0",
"find-config": "^1.0.0",
"fs": "0.0.1-security",
"glob-all": "^3.2.1",
"html-loader": "^0.5.5",
"html-replace-webpack-plugin": "^2.5.5",
"html-webpack-plugin": "^3.2.0",
"imagemin": "^5.3.1",
"imagemin-webp": "^6.0.0",
"imagemin-webpack-plugin": "^2.4.2",
"img-loader": "^3.0.0",
"jest": "^25.5.4",
"mini-css-extract-plugin": "^0.8.0",
"path": "^0.12.7",
"postcss": "^8.3.9",
"postcss-import": "^13.0.0",
"postcss-loader": "^4.1.0",
"postcss-mixins": "^7.0.2",
"postcss-nested": "^5.0.1",
"postcss-simple-vars": "^6.0.2",
"purgecss-webpack-plugin": "^1.6.0",
"stylelint": "^13.6.1",
"stylelint-config-recommended": "^3.0.0",
"stylelint-webpack-plugin": "^1.2.3",
"url-loader": "^1.1.1",
"vue": "^2.6.12",
"vue-click-outside": "^1.1.0",
"vue-custom-scrollbar": "^1.4.1",
"vue-jest": "^3.0.6",
"vue-loader": "^15.9.3",
"vue-template-compiler": "^2.6.12",
"webpack": "^4.44.1",
"webpack-cli": "^3.3.12",
"webpack-dev-server": "^3.11.0",
"webpack-fix-style-only-entries": "^0.4.0"
},
"dependencies": {
"#tailwindcss/typography": "^0.3.1",
"core-js": "^3.8.3",
"micromodal": "^0.4.10",
"regenerator-runtime": "^0.13.7",
"simplebar": "^5.3.6",
"tailwindcss": "^2.0.1",
"vuex": "^3.6.0"
}
}
any ideas?
downgrading to "postcss": "^8.2.1" solved the issue :)
Related
The problem occurs in a React app. When I build it with react-scripts locally, everything is built perfectly and styles are the way they should be. But when the app is built with Docker, the values of some properties in styles are replaced with CSS variables that are not defined. The version of Node.js used for creating the Docker container is exactly the same as on a local machine. Also bootstrap is used in the React app. Previously there wasn't such weird behavior and everything was built perfectly and no changed to styles were made.
Here's package.json:
{
"name": "minible-react",
"version": "1.0.0",
"private": true,
"dependencies": {
"#capaj/react-select-timezone": "^3.0.0",
"#emotion/react": "^11.5.0",
"#emotion/styled": "^11.3.0",
"#material-ui/core": "^4.12.3",
"#material-ui/icons": "^4.11.2",
"#material-ui/lab": "^4.0.0-alpha.60",
"#material-ui/pickers": "^3.3.10",
"#mui/icons-material": "^5.0.5",
"#mui/lab": "^5.0.0-alpha.51",
"#mui/material": "^5.0.4",
"#mui/styles": "^5.0.1",
"#testing-library/jest-dom": "^5.11.4",
"#testing-library/react": "^11.1.0",
"#testing-library/user-event": "^12.1.10",
"#types/date-fns": "^2.6.0",
"#visx/responsive": "^2.1.0",
"animate.css": "^4.1.1",
"apexcharts": "^3.27.3",
"availity-reactstrap-validation": "^2.7.0",
"axios": "^0.21.0",
"bootstrap": "^5.0.0-beta2",
"classnames": "^2.3.1",
"clsx": "^1.1.1",
"date-fns": "^2.23.0",
"file-saver": "^2.0.5",
"formik": "^2.2.9",
"husky": "^7.0.2",
"i18next": "^19.8.4",
"i18next-browser-languagedetector": "^6.0.1",
"leaflet": "^1.7.1",
"lint-staged": "^11.2.3",
"lodash": "^4.17.21",
"lodash.clonedeep": "^4.5.0",
"metismenujs": "^1.2.1",
"moment": "^2.29.1",
"moment-timezone": "^0.5.33",
"node-sass": "^4.0.0",
"prop-types": "^15.7.2",
"qs": "^6.11.0",
"query-string": "^7.0.1",
"react": "^17.0.2",
"react-bootstrap-sweetalert": "^5.2.0",
"react-color": "^2.19.3",
"react-countup": "^4.3.3",
"react-csv": "^2.0.3",
"react-date-range": "^1.3.0",
"react-datepicker": "^3.8.0",
"react-dom": "^17.0.1",
"react-i18next": "^11.8.5",
"react-icons": "^4.4.0",
"react-infinite-scroll-component": "^6.1.0",
"react-input-mask": "^2.0.4",
"react-modal": "^3.14.4",
"react-moment": "^1.1.1",
"react-phone-input-2": "^2.14.0",
"react-places-autocomplete": "^7.3.0",
"react-redux": "^7.2.2",
"react-redux-toastr": "7.5.2",
"react-router-dom": "^5.2.0",
"react-scripts": "4.0.1",
"react-select": "^3.2.0",
"react-select-async-paginate": "^0.6.0",
"react-slider-modal": "^1.3.1",
"react-slideshow-image": "^3.6.0",
"react-table": "^7.7.0",
"react-times": "^3.1.12",
"react-timezone-select": "^1.0.2",
"react-toastr": "^3.0.0",
"react-transition-group": "^4.4.2",
"reactstrap": "^8.9.0",
"recharts": "^2.1.0",
"recompose": "^0.30.0",
"redux": "^4.0.5",
"redux-thunk": "^2.3.0",
"save-dev": "0.0.1-security",
"simplebar-react": "^2.3.0",
"toastr": "^2.1.4",
"uuid": "^8.3.2",
"web-vitals": "^0.2.4",
"yup": "^0.32.9"
},
"scripts": {
"start": "react-scripts start",
"build": "react-scripts build",
"test": "react-scripts test",
"eject": "react-scripts eject"
},
"eslintConfig": {
"extends": [
"react-app",
"react-app/jest"
]
},
"browserslist": [
">0.2%",
"not dead",
"not op_mini all"
],
"devDependencies": {
"#iconify-icons/bi": "^1.1.5",
"#iconify/react": "^1.1.4",
"#visx/mock-data": "^2.1.0",
"animation.css": "^0.1.0",
"babel-eslint": "^10.1.0",
"eslint": "^7.11.0",
"eslint-config-airbnb": "^18.2.1",
"eslint-config-prettier": "^8.3.0",
"eslint-plugin-import": "^2.25.2",
"eslint-plugin-react": "^7.26.1",
"prettier": "^2.4.1",
"pretty-quick": "^3.1.1",
"redux-devtools": "^3.7.0"
}
}
Styles of component after local build
Styles of component after Docker build (all those variables are not defined)
I'll appreciate any ideas why it may be happening and how I could solve it.
Ive had the same issue and this solution working for me: unistall the node and Install it again.
I'm trying to use Bootstrap with a SSR React app. I installed several bootstrap npm packages, but when importing the css into a React component I get an unexpected token error. I made sure that I have css loaders in webpack, and from examples online it doesn't seem like I need to do anything other than importing the css into a component. I'm not sure what I'm doing wrong.
error:
C:\Users\aw030085\OneDrive - Cerner Corporation\Desktop\test2\myssr\node_modules\bootstrap\dist\css\bootstrap.min.css:6
*/:root{--blue:#007bff;--indigo:#6610f2;--purple:#6f42c1;--pink:#e83e8c;--red:#dc3545;--orange:#fd7e14;--yellow:#ffc107;--green:#28a745;--teal:#20c997;--cyan:#17a2b8;--white:#fff;--gray:#6c757d;--gray-dark:#343a40;--primary:#007bff;--secondary:#6c757d;--success:#28a745;--info:#17a2b8;--warning:#ffc107;--danger:#dc3545;--light:#f8f9fa;--dark:#343a40;--breakpoint-xs:0;--breakpoint-sm:576px;--breakpoint-md:768px;--breakpoint-lg:992px;--breakpoint-xl:1200px;--font-family-sans-serif:-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,"Helvetica Neue",Arial,"Noto Sans",sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol","Noto Color Emoji";--font-family-monospace:SFMono-Regular,Menlo,Monaco,Consolas,"Liberation Mono","Courier New",monospace}*,::after,::before{box-sizing:border-box}html{font-family:sans-serif;line-height:1.15;-webkit-text-size-adjust:100%;-webkit-tap-highlight-color:
SyntaxError: Unexpected token :
at new Script (vm.js:80:7)
at createScript (vm.js:274:10)
at Object.runInThisContext (vm.js:326:10)
at Module._compile (internal/modules/cjs/loader.js:664:28)
at Module._extensions..js (internal/modules/cjs/loader.js:712:10)
at Object.newLoader [as .js] (C:\Users\aw030085\OneDrive - Cerner Corporation\Desktop\test2\myssr\node_modules\pirates\lib\index.js:104:7)
at Module.load (internal/modules/cjs/loader.js:600:32)
at tryModuleLoad (internal/modules/cjs/loader.js:539:12)
at Function.Module._load (internal/modules/cjs/loader.js:531:3)
at Module.require (internal/modules/cjs/loader.js:637:17)
package.json dependencies:
"dependencies": {
"bootstrap": "^4.4.1",
"compression": "^1.7.4",
"express": "^4.17.1",
"immer": "^6.0.2",
"prop-types": "^15.7.2",
"react": "^16.12.0",
"react-bootstrap": "^1.0.0",
"react-dom": "^16.12.0",
"react-redux": "^7.2.0",
"react-router-dom": "^5.1.2",
"react-toastify": "^5.5.0",
"redux": "^4.0.5",
"redux-thunk": "^2.3.0"
},
"devDependencies": {
"#babel/cli": "^7.8.4",
"#babel/core": "^7.9.0",
"#babel/node": "^7.8.7",
"#babel/plugin-proposal-class-properties": "^7.8.3",
"#babel/plugin-transform-runtime": "^7.9.0",
"#babel/polyfill": "^7.8.7",
"#babel/preset-env": "^7.9.0",
"#babel/preset-react": "^7.9.4",
"babel-eslint": "^10.1.0",
"babel-loader": "^8.1.0",
"css-loader": "^3.4.2",
"enzyme": "^3.11.0",
"enzyme-adapter-react-16": "^1.15.2",
"eslint": "^6.8.0",
"eslint-loader": "^3.0.3",
"eslint-plugin-import": "^2.20.1",
"eslint-plugin-react": "^7.19.0",
"jest": "^25.1.0",
"nodemon": "^2.0.2",
"npm-run-all": "^4.1.5",
"serialize-javascript": "^3.0.0",
"style-loader": "^1.1.3",
"webpack": "^4.42.1",
"webpack-cli": "^3.3.11"
}
webpack:
const path = require("path");
const webpack = require('webpack');
module.exports = {
entry: "./src/components/index.js",
output: {
path: path.resolve(__dirname, "public"),
filename: "[name].js"
},
module: {
rules: [
{
test: /\.(js|jsx)$/,
exclude: /node_modules/,
use: ["babel-loader"]
},
{
test: /(\.css)$/,
use: ["style-loader", "css-loader"]
}
]
},
resolve: {
extensions: [".js", ".jsx", ".json", ".wasm", ".mjs", "*"]
},
plugins: [
new webpack.DefinePlugin({
'process.env': {
NODE_ENV: '"development"'
},
}),
]
};
Header.js
import React from 'react';
import { Navbar, Nav} from 'react-bootstrap';
import 'bootstrap/dist/css/bootstrap.min.css';
const Header = () => {
return (
<>
<Navbar bg="light" variant="light">
<Navbar.Brand href="/">Brand</Navbar.Brand>
<Nav className="mr-auto">
<Nav.Link href="/">Home</Nav.Link>
<Nav.Link href="/world">World</Nav.Link>
</Nav>
</Navbar>
</>
)
}
export default Header;
Also you write you only use css bootstrap.js requires jQuery. So
npm install jquery#latest
might be the step you missed
I have used ngx-toastr module to show toastr in my angular application It is working fine with Chorme,Firefox but not working in IE ie it is working in ngOninit() function but not in any other function
.
import { ToastrModule } from 'ngx-toastr';
In my case, the toast container was being shown in DOM, but the toast itself wasn't being displayed.
(You can check if this is your case inspecting the DOM and looking for the text "toast-container", which the container div has).
I tried uncommenting polyfills lines and everything until I realized the toast was being set the property "display:none" for some reason by IE.
The thing that worked for me was just adding this to my styles.scss:
#media all and (-ms-high-contrast: none), (-ms-high-contrast: active) {
/* IE10+ CSS styles go here */
.toast {
display: block !important;
}
}
#supports (-ms-accelerator:true) {
/* IE Edge 12+ CSS styles go here */
.toast {
display: block !important;
}
}
Hope this helps!
polyfills.ts
/**
This file includes polyfills needed by Angular and is loaded before the app.
You can add your own extra polyfills to this file.
*
This file is divided into 2 sections:
Browser polyfills. These are applied before loading ZoneJS and are sorted by browsers.
Application imports. Files imported after ZoneJS that should be loaded before your main
file.
*
The current setup is for so-called "evergreen" browsers; the last versions of browsers that
automatically update themselves. This includes Safari >= 10, Chrome >= 55 (including Opera),
Edge >= 13 on the desktop, and iOS 10 and Chrome on mobile.
*
Learn more in https://angular.io/docs/ts/latest/guide/browser-support.html
*/
/***************************************************************************************************
BROWSER POLYFILLS
*/
/** IE9, IE10 and IE11 requires all of the following polyfills. **/
import 'core-js/es6/symbol';
import 'core-js/es6/object';
import 'core-js/es6/function';
import 'core-js/es6/parse-int';
import 'core-js/es6/parse-float';
import 'core-js/es6/number';
import 'core-js/es6/math';
import 'core-js/es6/string';
import 'core-js/es6/date';
import 'core-js/es6/array';
import 'core-js/es6/regexp';
import 'core-js/es6/map';
import 'core-js/es6/weak-map';
import 'core-js/es6/set';
/** IE10 and IE11 requires the following for NgClass support on SVG elements */
import 'classlist.js'; // Run npm install --save classlist.js.
/** IE10 and IE11 requires the following for the Reflect API. */
import 'core-js/es6/reflect';
/** Evergreen browsers require these. **/
// Used for reflect-metadata in JIT. If you use AOT (and only Angular decorators), you can remove.
import 'core-js/es7/reflect';
/**
Web Animations #angular/platform-browser/animations
Only required if AnimationBuilder is used within the application and using IE/Edge or Safari.
Standard animation support in Angular DOES NOT require any polyfills (as of Angular 6.0).
**/
import 'web-animations-js'; // Run npm install --save web-animations-js.
/**
By default, zone.js will patch all possible macroTask and DomEvents
user can disable parts of macroTask/DomEvents patch by setting following flags
*/
(window as any).__Zone_disable_requestAnimationFrame = true; // disable patch requestAnimationFrame
(window as any).__Zone_disable_on_property = true; // disable patch onProperty such as onclick
(window as any).__zone_symbol__BLACK_LISTED_EVENTS = ['scroll', 'mousemove']; // disable patch specified eventNames
/*
in IE/Edge developer tools, the addEventListener will also be wrapped by zone.js
with the following flag, it will bypass zone.js patch for IE/Edge
*/
(window as any).__Zone_enable_cross_context_check = true;
/***************************************************************************************************
Zone JS is required by default for Angular itself.
*/
import 'zone.js/dist/zone'; // Included with Angular CLI.
/***************************************************************************************************
APPLICATION IMPORTS
*/
// Add global to window, assigning the value of window itself.
(window as any)['global'] = window;
if (!Element.prototype.matches) {
Element.prototype.matches = (<any>Element.prototype).msMatchesSelector ||
Element.prototype.webkitMatchesSelector;
}
package.json
{
"name": "xtreme-admin-angular",
"version": "0.0.0",
"scripts": {
"ng": "ng",
"start": "node app.js",
"build": "ng build",
"test": "ng test",
"lint": "ng lint",
"e2e": "ng e2e",
"postinstall": "node patch-webpack.js"
},
"private": true,
"dependencies": {
"#agm/core": "^1.0.0-beta.7",
"#angular/animations": "^7.0.1",
"#angular/common": "^7.0.1",
"#angular/compiler": "^7.0.1",
"#angular/core": "^7.0.1",
"#angular/forms": "^7.0.1",
"#angular/http": "^7.0.1",
"#angular/platform-browser": "^7.0.1",
"#angular/platform-browser-dynamic": "^7.0.1",
"#angular/router": "^7.0.1",
"#jaspero/ng-confirmations": "^0.4.7",
"#jaspero/ng2-confirmations": "^0.3.3",
"#ng-bootstrap/ng-bootstrap": "^3.3.1",
"#swimlane/ngx-charts": "^7.0.1",
"#swimlane/ngx-datatable": "^13.1.0",
"#types/crypto-js": "^3.1.43",
"angular-calendar": "^0.25.2",
"angular-datatables": "^6.0.0",
"angular2-notifications": "^2.0.0",
"bcryptjs": "^2.4.3",
"bootstrap": "^4.1.3",
"c3": "^0.4.23",
"chart.js": "^2.8.0",
"chartist": "^0.11.3",
"classlist.js": "^1.1.20150312",
"compression": "^1.7.4",
"core-js": "^2.6.9",
"critical": "^1.3.6",
"crypto-js": "^3.1.9-1",
"d3": "^4.8.0",
"datatables.net": "^1.10.16",
"datatables.net-dt": "^1.10.16",
"express": "^4.17.1",
"express-simple-cdn": "^1.0.1",
"jquery": "^3.4.1",
"jspdf": "^1.5.3",
"jspdf-autotable": "^3.2.4",
"karma-html-reporter": "^0.2.7",
"karma-phantomjs-launcher": "^1.0.4",
"karma-teamcity-reporter": "^1.1.0",
"ng-chartist": "^1.1.1",
"ng2-charts": "^1.6.0",
"ng2-dragula": "^1.5.0",
"ng2-file-upload": "^1.3.0",
"ng2-smart-table": "1.2.2",
"ngx-loading": "^3.0.1",
"ngx-owl-carousel": "^2.0.7",
"ngx-owl-carousel-o": "^2.0.1",
"ngx-pagination": "^4.1.0",
"ngx-perfect-scrollbar": "6.1.0",
"ngx-quill": "^3.6.0",
"ngx-slick-carousel": "^0.4.6",
"ngx-spinner": "^7.2.0",
"ngx-toastr": "^8.7.3",
"ngx-tooltip": "0.0.9",
"node-sass": "^4.12.0",
"owl.carousel": "^2.3.4",
"pace-js": "^1.0.2",
"quill": "^1.3.6",
"remove-node-modules": "^1.7.6",
"rxjs": "^6.5.2",
"rxjs-compat": "^6.5.2",
"script-loader": "^0.7.2",
"slick-carousel": "^1.8.1",
"web-animations-js": "^2.3.2",
"zone.js": "^0.8.29"
},
"devDependencies": {
"#angular-builders/custom-webpack": "^8.2.0",
"#angular-devkit/build-angular": "^0.10.7",
"#angular/cli": "~7.0.3",
"#angular/compiler-cli": "^7.0.1",
"#angular/language-service": "^7.0.1",
"#types/c3": "^0.6.4",
"#types/chartist": "^0.9.46",
"#types/datatables.net": "^1.10.17",
"#types/jasmine": "~2.8.6",
"#types/jasminewd2": "~2.0.3",
"#types/jquery": "^3.3.22",
"#types/node": "~8.9.4",
"codelyzer": "~4.2.1",
"css-aspect-ratio": "^1.0.5",
"jasmine-core": "~2.99.1",
"jasmine-spec-reporter": "~4.2.1",
"karma": "~1.7.1",
"karma-chrome-launcher": "~2.2.0",
"karma-coverage-istanbul-reporter": "~1.4.2",
"karma-jasmine": "~1.1.1",
"karma-jasmine-html-reporter": "^0.2.2",
"protractor": "^5.4.2",
"ts-node": "~5.0.1",
"tslint": "~5.9.1",
"typescript": "3.1.6"
},
"browser": {
"crypto": false,
"stream": false
}
}
I am using react-static and I also want to use sass.
This is my package.json:
"dependencies": {
"#reach/router": "^1.2.1",
"axios": "^0.19.0",
"bulma": "^0.8.0",
"bulma-start": "^0.0.3",
"node-sass": "^4.13.0",
"react": "^16.9.0",
"react-dom": "^16.9.0",
"react-icons": "^3.8.0",
"react-router-dom": "^5.1.2",
"react-slick": "^0.25.2",
"react-static": "^7.2.0",
"react-static-plugin-reach-router": "^7.2.0",
"react-static-plugin-sass": "^7.2.2",
"react-static-plugin-sitemap": "^7.2.0",
"react-static-plugin-source-filesystem": "^7.2.0",
"slick-carousel": "^1.8.1"
}
As I know, to use sass add node-sass and import SCSS file.
But it doesn't work.
It looks like they have a plugin on SASS integration. Follow their installation and after that you can import your SASS files.
you can use webpack for this.
{
test: /\.s[ac]ss$/i,
use: [
'style-loader',
'css-loader',
'sass-loader',
]
}
add this in your "rules" array under "module" object.
I'm converting a project of mine from AngularJS to VueJS. I'm trying to figure out how to include #fortawesome/fontawesome-free without using vue-fontawesome. I feel that it is easier to add icons without vue-fontawesome implementation (copying and pasting directly from their site examples).
I'm having trouble importing it in my main.js. This doesn't seem to work:
#main.js
import '#fortawesome/fontawesome-free/css/all.css';
None of the icons are working. However, if I add the fontawesome 5 directly on the html page as a static, they show up. How can I use vanilla fontawesome 5 on my VueJS app?
Setup:
Symfony 4 with Encore (webpack.config.js):
var Encore = require('#symfony/webpack-encore');
Encore
.setOutputPath('public/build/')
.setPublicPath('/build')
.cleanupOutputBeforeBuild()
.enableSourceMaps(!Encore.isProduction())
.addStyleEntry('css/app', './assets/css/app.css')
.addEntry('js/app', './assets/js/main.js')
.enableSassLoader()
.autoProvidejQuery()
// Enable Vue loader
.enableVueLoader()
;
module.exports = Encore.getWebpackConfig();
Here is my package.json:
{
"devDependencies": {
"#babel/core": "^7.0.0-rc.3",
"#babel/polyfill": "^7.0.0",
"#babel/preset-env": "^7.0.0-rc.3",
"#symfony/webpack-encore": "^0.17.0",
"#vue/cli-plugin-babel": "^3.0.0-rc.3",
"babel-jest": "^23.2.0",
"babel-loader": "^8.0.2",
"less-loader": "^4.1.0",
"node-sass": "^4.9.2",
"sass-loader": "^7.1.0",
"vue-loader": "^14",
"vue-template-compiler": "^2.5.17",
"webpack-notifier": "^1.6.0"
},
"license": "UNLICENSED",
"private": true,
"scripts": {
"dev-server": "encore dev-server",
"dev": "encore dev",
"watch": "encore dev --watch",
"build": "encore production"
},
"dependencies": {
"#fortawesome/fontawesome-free": "^5.5.0",
"#fortawesome/fontawesome-svg-core": "^1.2.8",
"#fortawesome/free-solid-svg-icons": "^5.5.0",
"#fortawesome/vue-fontawesome": "^0.1.2",
"axios": "^0.18.0",
"bootstrap": "^4.1.1",
"bootstrap-vue": "^2.0.0-rc.11",
"jquery": "^3.3.1",
"npm": "^6.4.0",
"style-loader": "^0.23.1",
"sweetalert2": "^7.26.12",
"vue": "^2.5.17",
"vue-router": "^3.0.1",
"vuelidate": "^0.7.4",
"vuex": "^3.0.1"
}
}