I'm having issues getting CSS modules to work in Webpack. I'm trying to use react-day-picker with custom styles. When I log the imported CSS module to see the class name mapping I get undefined. The DayPicker component is not receiving any of the classNames. My Webpack loaders config:
module: {
loaders: [
{
test: /\.scss$/,
loaders: [
"style-loader",
{ loader: "css-loader", options: { modules: true } },
"sass-loader"
],
exclude: ["node_modules"]
},
// ...
{
test: /\.css$/,
loaders: [
"style-loader",
{ loader: "css-loader", options: { modules: true } }
],
exclude: ["node_modules"]
},
// ...
The way I'm trying to import the css module:
import calendarStyles from './cardCalendar.css';
const Calendar = props => {
console.log("CALENDAR STYLES", calendarStyles);
return(
<div className="profile-component-calendar">
<div className="component-title">Calendar</div>
{props.calendarDropdownConfig.items && (
<CalendarInfoDropdown {...props.calendarDropdownConfig} />
)}
<div id="calendar-card-component" style={someStyle}>
<DayPicker
{...props}
classNames={calendarStyles}
showWeekNumbers
firstDayOfWeek={1}
/>
</div>
</div>
)
} ;
Project dependencies:
"dependencies": {
"#navjobs/upload": "^3.0.7",
"body-parser": "^1.17.2",
"bootstrap": "^3.3.7",
"cfenv": "^1.0.4",
"change-case": "^3.0.1",
"docxtemplater": "^3.1.7",
"dotenv": "^4.0.0",
"dotenv-webpack": "^1.5.4",
"express": "^4.15.4",
"express-session": "^1.15.5",
"file-saver": "^1.3.3",
"helmet": "^3.8.1",
"jquery": "^3.2.1",
"jquery-ui": "^1.12.1",
"jszip": "^2.6.1",
"mathjs": "^3.16.3",
"moment": "^2.19.1",
"moment-timezone": "^0.5.14",
"node-sass": "^4.5.3",
"prop-types": "^15.5.10",
"rc-slider": "^8.3.1",
"rc-tooltip": "^3.4.8",
"react": "^16.2.0",
"react-addons-shallow-compare": "^15.6.2",
"react-autocomplete": "^1.7.1",
"react-bootstrap": "^0.31.2",
"react-bootstrap-daterangepicker": "^3.4.1",
"react-day-picker": "^7.0.7",
"react-dom": "^16.2.0",
"react-dropzone": "^4.0.0",
"react-images": "^0.5.5",
"react-intl": "^2.3.0",
"react-router": "^4.1.2",
"react-router-dom": "^4.1.2",
"react-select": "^1.0.0-rc.5",
"react-spinkit": "^3.0.0",
"react-stepzilla": "^4.6.3",
"react-toggle": "^4.0.2",
"redux": "^3.7.2",
"redux-saga": "^0.15.6",
"sass-loader": "^6.0.2",
"styled-components": "^2.1.2"
},
"devDependencies": {
"autoprefixer": "^7.1.2",
"babel-cli": "^6.24.1",
"babel-core": "^6.25.0",
"babel-eslint": "^7.2.3",
"babel-jest": "^20.0.3",
"babel-loader": "^7.1.1",
"babel-plugin-transform-class-properties": "^6.24.1",
"babel-plugin-transform-decorators-legacy": "^1.3.4",
"babel-plugin-transform-object-rest-spread": "^6.26.0",
"babel-plugin-transform-runtime": "^6.23.0",
"babel-preset-env": "^1.6.0",
"babel-preset-es2015": "^6.24.1",
"babel-preset-flow": "^6.23.0",
"babel-preset-react": "^6.24.1",
"babel-runtime": "^6.25.0",
"connect-history-api-fallback": "^1.3.0",
"css-loader": "^0.28.4",
"enzyme": "^2.9.1",
"eslint": "^3.19.0",
"eslint-config-airbnb": "^15.0.1",
"eslint-config-prettier": "^2.3.0",
"eslint-import-resolver-webpack": "^0.8.3",
"eslint-plugin-flowtype": "^2.39.1",
"eslint-plugin-import": "^2.7.0",
"eslint-plugin-jest": "^20.0.3",
"eslint-plugin-jsx-a11y": "^5.0.1",
"eslint-plugin-prettier": "^2.2.0",
"eslint-plugin-react": "^7.1.0",
"exports-loader": "^0.6.4",
"extract-text-webpack-plugin": "^3.0.0",
"file-loader": "^0.11.2",
"flow-bin": "^0.56.0",
"html-webpack-plugin": "^2.30.1",
"image-webpack-loader": "^3.3.1",
"immutability-helper": "^2.3.1",
"imports-loader": "^0.7.1",
"jest-cli": "^21.1.0",
"json-loader": "^0.5.7",
"lodash": "^4.17.4",
"loglevel": "^1.4.1",
"morgan": "^1.8.2",
"postcss-loader": "^2.0.6",
"prettier": "^1.5.3",
"prettier-eslint": "^6.4.2",
"ramda": "^0.24.1",
"react-addons-test-utils": "^15.6.0",
"react-content-loader": "^1.4.0",
"react-helmet": "^5.2.0",
"react-hot-loader": "^3.0.0-beta.6",
"react-loadable": "^4.0.5",
"react-test-renderer": "^15.6.1",
"regenerator-runtime": "^0.10.5",
"style-loader": "^0.18.2",
"url-loader": "^0.5.9",
"wallaby-webpack": "^0.0.40",
"webpack": "^3.5.4",
"webpack-bundle-analyzer": "^2.9.0",
"webpack-cleanup-plugin": "^0.5.1",
"webpack-dashboard": "^0.4.0",
"webpack-dev-server": "^2.7.1"
},
As far as I can see, I'm doing the import as described in https://github.com/webpack-contrib/css-loader. Can anyone see what I'm doing wrong?
Try this way for className. Div should get profile-component-calendar class style.
<div className={calendarStyles.profile-component-calendar}>
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.
Module build failed: Error: Cannot find module 'babel-core'
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:636:15)
sharing package.json file
"dependencies": {
"babel-loader": "^7.1.5",
"cli-color": "^2.0.0",
"colors": "^1.3.3",
"diff": "^4.0.1",
"file-loader": "^4.2.0",
"google-spreadsheet-to-json": "^1.0.0",
"gulp-template": "^5.0.0",
"html-webpack-plugin": "^3.0.6",
"i": "^0.3.6",
"lodash": "^4.17.5",
"mkdirp": "^0.5.1",
"modernizr": "^3.6.0",
"moment": "^2.24.0",
"npm": "^6.12.0",
"npm-check-updates": "^3.1.25",
"prop-types": "^15.6.1",
"puppeteer": "^1.14.0",
"react": "^16.8.6",
"react-dom": "^16.2.0",
"react-ga": "^2.4.1",
"react-graceful-unmount": "^1.0.7",
"react-iframe": "^1.8.0",
"react-loadable": "^5.3.1",
"react-onclickoutside": "^6.7.1",
"react-redux": "^7.1.1",
"react-router": "^5.1.2",
"react-router-dom": "^5.1.2",
"react-slick": "^0.25.2",
"redux": "^4.0.4",
"redux-thunk": "^2.2.0",
"scriptjs": "^2.5.8",
"slick-carousel": "^1.8.1",
"uglifyjs-webpack-plugin": "^2.2.0",
"url-loader": "^2.2.0",
"webpack": "^3.11.0",
"webpack-browser-plugin": "^1.0.20",
"webpack-dev-server": "^2.11.2",
"webpack-merge": "^4.1.2",
"whatwg-fetch": "^3.0.0",
"yargs": "^14.2.0"
},
"devDependencies": {
"#babel/cli": "^7.6.4",
"#babel/core": "^7.6.4",
"#babel/plugin-proposal-class-properties": "^7.5.5",
"#babel/preset-env": "^7.6.3",
"#babel/preset-react": "^7.6.3",
"babel-eslint": "^8.2.2",
"babel-minify": "^0.3.0",
"babel-plugin-syntax-dynamic-import": "^6.18.0",
"babel-polyfill": "^6.26.0",
"babel-preset-env": "^1.7.0",
"babel-preset-es2015": "^6.24.1",
"babel-preset-react": "^6.24.1",
"babel-preset-stage-2": "^6.24.1",
"babel-register": "^6.24.1",
"cross-env": "^6.0.3",
"css-loader": "^3.2.0",
"del": "^5.1.0",
"eslint": "^4.18.2",
"eslint-config-airbnb": "^16.1.0",
"eslint-plugin-import": "^2.9.0",
"eslint-plugin-jsx-a11y": "^6.0.3",
"eslint-plugin-react": "^7.7.0",
"gulp": "^3.9.1",
"gulp-awspublish": "^3.3.1",
"gulp-babel": "^7.0.1",
"gulp-bump": "^3.1.3",
"gulp-git": "^2.9.0",
"gulp-if": "^2.0.2",
"gulp-prompt": "^1.2.0",
"gulp-rename": "^1.2.2",
"json-loader": "^0.5.7",
"modernizr-loader": "^1.0.1",
"node-sass": "^4.7.2",
"path": "^0.12.7",
"prettier-eslint": "^8.8.2",
"react-hot-loader": "^4.0.0",
"sass-loader": "^8.0.0",
"style-loader": "^1.0.0",
"webpack-cli": "^3.3.9"
},
"scripts": {
"install": "npm run install-webpack-dev-server",
"install-webpack-dev-server": "npm install -g webpack webpack-dev-server",
"prebuild": "gulp clean && gulp bump",
"build": "cross-env NODE_ENV=production webpack --config webpack.prod.js",
"prepublish": "npm run build",
"publish": "gulp publish && gulp git",
"push": "npm run publish && gulp sync",
"start": "cross-env NODE_ENV=development webpack-dev-server --progress --inline --hot --config webpack.dev.js",
"split": "gulp react-split"
}
}
I have a Next.js project with aws-amplify. When I do yarn build I get the following error:
> Build error occurred
{ /Users/imyjimmy/project/node_modules/#aws-amplify/ui/dist/style.css:13
:root {
^
SyntaxError: Unexpected token :
And yes, I have tried adding the following at the top of next.config.js:
if (typeof require !== 'undefined') {
require.extensions['.less'] = () => {}
require.extensions['.css'] = file => {}
}
It makes no difference.
Here are my dependencies:
"dependencies": {
"#material-ui/core": "latest",
"#material-ui/icons": "latest",
"#material-ui/styles": "latest",
"#zeit/next-css": "^1.0.1",
"apollo-boost": "^0.1.16",
"apollo-client": "^2.4.2",
"async": "^3.1.0",
"aws-amplify": "^1.1.32",
"aws-amplify-react": "^2.3.11",
"axios": "^0.19.0",
"babel-core": "^7.0.0-bridge.0",
"clsx": "latest",
"date-fns": "^2.0.0-alpha.7",
"downshift": "^2.2.3",
"enzyme": "^3.6.0",
"enzyme-adapter-react-16": "^1.5.0",
"graphql": "^14.0.2",
"graphql-tag": "^2.9.2",
"lodash.debounce": "^4.0.8",
"next": "latest",
"next-with-apollo": "^3.1.3",
"nprogress": "^0.2.0",
"prop-types": "latest",
"react": "latest",
"react-adopt": "^0.6.0",
"react-apollo": "^2.2.1",
"react-dom": "latest",
"react-stripe-checkout": "^2.6.3",
"react-transition-group": "^2.5.0",
"url-loader": "^2.0.1",
"webpack": "^4.39.2"
},
"devDependencies": {
"babel-jest": "^23.6.0",
"babel-plugin-module-resolver": "^3.1.1",
"casual": "^1.5.19",
"css-loader": "^3.1.0",
"enzyme-to-json": "^3.3.4",
"graphql-tools": "^4.0.0",
"jest": "^23.6.0",
"jest-transform-graphql": "^2.1.0"
},
Any help would be greatly appreciated. Thanks.
I am updating one of my projects to use meteor version 1.7 from 1.4 and the following error is happening. I tried to reinstall meteor, downgrading to 1.6 and also added .babelrc file but no luck. I think the error is about the ecmascript and babel-compiler package version because it works fine when it is at version 1.4. Does anyone have idea on how to resolve this problem? Thank you very much!
While processing files with ecmascript (for target os.osx.x86_64):
/Users/lauyi/.meteor/packages/meteor-tool/.1.7.0_3.w8zcf.uowlh++os.osx.x86_64+web.browser+web.browser.legacy+web.cordova/mt-os.osx.x86_64/tools/isobuild/compiler-plugin.js:447:61:
Cannot read property 'id' of null
at InputFile.resolve
(/Users/lauyi/.meteor/packages/meteor-tool/.1.7.0_3.w8zcf.uowlh++os.osx.x86_64+web.browser+web.browser.legacy+web.cordova/mt-os.osx.x86_64/tools/isobuild/compiler-plugin.js:447:61)
at packages/babel-compiler.js:487:23
at Array.some (<anonymous>:null:null)
at requireWithPrefixes (packages/babel-compiler.js:482:26)
at requireWithPath (packages/babel-compiler.js:415:14)
at resolveHelper (packages/babel-compiler.js:387:24)
at packages/babel-compiler.js:360:19
at Array.forEach (<anonymous>:null:null)
at walkHelper (packages/babel-compiler.js:359:10)
at walkBabelRC (packages/babel-compiler.js:340:24)
at BabelCompiler.BCp._inferHelper (packages/babel-compiler.js:442:17)
at BabelCompiler.BCp._inferFromBabelRc (packages/babel-compiler.js:287:14)
at BabelCompiler.BCp.inferExtraBabelOptions (packages/babel-compiler.js:261:10)
at BabelCompiler.BCp.processOneFileForTarget (packages/babel-compiler.js:184:10)
at BabelCompiler.<anonymous> (packages/babel-compiler.js:115:26)
at Array.forEach (<anonymous>:null:null)
at BabelCompiler.BCp.processFilesForTarget (packages/babel-compiler.js:114:14)
This is my package.json
{
"browserslist": [
"last 2 versions",
"> 1%"
],
"dependencies": {
"#babel/runtime": "^7.0.0-beta.53",
"babel-polyfill": "^6.22.0",
"babel-runtime": "^6.20.0",
"browser-compress-image": "^1.0.2",
"datatables.net-bs": "^1.10.15",
"exif-js": "^2.3.0",
"html-purify": "^1.1.0",
"image-compressor": "github:xkeshi/image-compressor",
"intl": "^1.2.5",
"intl-locales-supported": "^1.0.0",
"jquery": "^2.2.4",
"knox": "^0.9.2",
"meteor-node-stubs": "^0.3.3",
"moment": "^2.17.1",
"mongo-xlsx": "^1.0.12",
"open-graph-scraper": "^2.4.2",
"prop-types": "^15.5.8",
"rc-tabs": "^9.1.4",
"react": "^0.14.8",
"react-addons-create-fragment": "^0.14.8",
"react-addons-css-transition-group": "^0.14.8",
"react-addons-linked-state-mixin": "^0.14.8",
"react-addons-perf": "^0.14.8",
"react-addons-pure-render-mixin": "^0.14.8",
"react-addons-test-utils": "^0.14.8",
"react-addons-transition-group": "^0.14.8",
"react-addons-update": "^0.14.8",
"react-autosuggest": "^8.0.0",
"react-avatar-editor": "^9.1.0",
"react-bootstrap-table": "^3.4.6",
"react-categorized-tag-input": "^2.1.2",
"react-dom": "^0.14.8",
"react-dropzone-component": "^1.4.1",
"react-intl": "^2.2.3",
"react-linkify": "^0.2.0",
"react-paginate": "^4.4.3",
"react-player": "^0.20.0",
"react-radio-group": "^3.0.1",
"react-rater": "^0.4.2",
"react-redux": "^5.0.2",
"react-router": "^3.0.0",
"react-router-scroll": "^0.4.1",
"react-select": "^1.0.0-rc.3",
"react-slick": "^0.14.5",
"react-tabs": "^0.8.2",
"react-toastr": "^2.8.2",
"react-truncate": "^2.1.4",
"redux": "^3.6.0",
"redux-devtools": "^3.3.2",
"request": "^2.81.0",
"simpl-schema": "^1.4.2",
"slick-carousel": "^1.6.0",
"underscore": "^1.8.3",
"uuid": "^3.1.0",
"zxcvbn": "^4.4.1"
},
"devDependencies": {
"autoprefixer": "^7.1.1",
"babel-jest": "^20.0.3",
"babel-preset-react": "^6.24.1",
"eslint": "^3.15.0",
"eslint-config-airbnb": "^14.1.0",
"eslint-config-google": "^0.7.1",
"eslint-plugin-compat": "^1.0.3",
"eslint-plugin-import": "^2.2.0",
"eslint-plugin-jsx-a11y": "^4.0.0",
"eslint-plugin-react": "^6.9.0",
"jest": "^20.0.4",
"navalia": "^1.2.0",
"react-test-renderer": "^15.6.1",
"stylelint": "^7.10.1",
"stylelint-no-unsupported-browser-features": "^1.0.0"
},
"postcss": {
"plugins": {
"autoprefixer": {}
}
},
"stylelint": {
"plugins": [
"stylelint-no-unsupported-browser-features"
],
"rules": {
"plugin/no-unsupported-browser-features": true
}
},
"scripts": {
"test": "jest"
},
"jest": {
"scriptPreprocessor": "<rootDir>/node_modules/babel-jest",
"testFileExtensions": [
"js",
"jsx"
],
"transformIgnorePatterns": [
"<rootDir>/node_modules"
],
"unmockedModulePathPatterns": [
"<rootDir>/node_modules/react",
"<rootDir>/node_modules/navalia"
],
"moduleFileExtensions": [
"js",
"json",
"jsx"
]
}
}
This is my ./meteor/version
accounts-base#1.4.2
accounts-password#1.5.1
alanning:roles#1.2.16
aldeed:collection2-core#2.1.2
aldeed:tabular#2.1.1
allow-deny#1.1.0
autoupdate#1.4.1
babel-compiler#7.1.1
babel-runtime#1.2.2
base64#1.0.11
binary-heap#1.0.10
blaze#2.3.2
blaze-html-templates#1.1.2
blaze-tools#1.0.10
boilerplate-generator#1.5.0
browser-policy-common#1.0.11
browser-policy-framing#1.1.0
caching-compiler#1.1.12
caching-html-compiler#1.1.3
callback-hook#1.1.0
cfs:access-point#0.1.49
cfs:base-package#0.0.30
cfs:collection#0.5.5
cfs:collection-filters#0.2.4
cfs:data-man#0.0.6
cfs:file#0.1.17
cfs:filesystem#0.1.2
cfs:http-methods#0.0.32
cfs:http-publish#0.0.13
cfs:power-queue#0.9.11
cfs:reactive-list#0.0.9
cfs:reactive-property#0.0.4
cfs:standard-packages#0.5.10
cfs:storage-adapter#0.2.4
cfs:tempstore#0.1.6
cfs:upload-http#0.0.20
cfs:worker#0.1.5
check#1.3.1
coffeescript#1.0.17
cosmos:browserify#0.10.0
dburles:collection-helpers#1.1.0
ddp#1.4.0
ddp-client#2.3.3
ddp-common#1.4.0
ddp-rate-limiter#1.0.7
ddp-server#2.2.0
deps#1.0.12
diff-sequence#1.1.0
dynamic-import#0.4.1
ecmascript#0.11.1
ecmascript-runtime#0.7.0
ecmascript-runtime-client#0.7.1
ecmascript-runtime-server#0.7.0
ejson#1.1.0
email#1.2.3
es5-shim#4.8.0
fortawesome:fontawesome#4.7.0
fourseven:scss#3.13.0
gadicc:blaze-react-component#1.4.1
geojson-utils#1.0.10
hot-code-push#1.0.4
html-tools#1.0.11
htmljs#1.0.11
http#1.4.1
id-map#1.1.0
jcbernack:reactive-aggregate#0.7.0
jquery#1.11.11
juliancwirko:postcss#1.3.0
launch-screen#1.1.1
less#2.7.12
livedata#1.0.18
localstorage#1.2.0
logging#1.1.20
matb33:collection-hooks#0.8.4
mdg:validated-method#1.1.0
mdg:validation-error#0.5.1
meteor#1.9.2
meteor-base#1.4.0
meteorhacks:aggregate#1.3.0
meteorhacks:async#1.0.0
meteorhacks:collection-utils#1.2.0
meteorhacks:npm#1.5.0
minifier-css#1.3.1
minifiers-js#1.1.8-modules.8
minimongo#1.4.4
mobile-experience#1.0.5
mobile-status-bar#1.0.14
modern-browsers#0.1.2
modules#0.12.2
modules-runtime#0.10.2
momentjs:moment#2.8.4
mongo#1.5.1
mongo-dev-server#1.1.0
mongo-id#1.0.7
mongo-livedata#1.0.12
mrt:smart-publish#0.2.1
nilsdannemann:pdfmake#1.0.38
npm-bcrypt#0.9.3
npm-container#1.2.0
npm-mongo#3.0.7
observe-sequence#1.0.16
okgrow:analytics#2.1.3
ordered-dict#1.1.0
percolate:migrations#0.9.8
percolate:synced-cron#1.3.2
promise#0.11.1
raix:eventemitter#0.1.3
random#1.1.0
rate-limit#1.0.9
react#0.14.6
react-meteor-data#0.2.16
react-runtime#0.14.5
reactive-dict#1.2.0
reactive-var#1.0.11
reload#1.2.0
retry#1.1.0
routepolicy#1.0.13
schat:client-blaze#1.2.0
schat:client-core#1.2.1
service-configuration#1.0.11
session#1.1.7
sha#1.0.9
shell-server#0.3.1
socket-stream-client#0.2.2
spacebars#1.0.15
spacebars-compiler#1.1.3
srp#1.0.10
standard-minifiers-js#1.0.3-modules.8
templating#1.3.2
templating-compiler#1.3.3
templating-runtime#1.3.2
templating-tools#1.1.2
tmeasday:check-npm-versions#0.3.2
tracker#1.2.0
tsega:bootstrap3-datetimepicker#4.17.37_1
twbs:bootstrap#3.3.6
ui#1.0.13
underscore#1.0.10
url#1.2.0
webapp#1.6.2
webapp-hashing#1.0.9
Using yarn install instead of npm install solved the problem.
I am working on an Angular2 & ASP.NET Core project with webpack and I suddenly get an error. I didn't have this error yesterday and I didn't make any changes today. Does anyone have an idea what the problem is?
Exception: Call to Node module failed with error: TypeError: Cannot read property 'SelectorMatcher' of undefined
at Object. (C:\Users\john\Desktop\WORKSHOP...\node_modules\angular2-platform-node__private_imports__.js:21:54)
My package.json
{
"name": "Angular2Workshop",
"version": "0.1.0",
"description": "A simple application with an Angular 2 app and a Asp.Net Core Backend",
"license": "UNLICENSED",
"scripts": {
"test": "./node_modules/.bin/karma start",
"postinstall": "typings install && npm uninstall selenium-webdriver"
},
"dependencies": {
"#angular/common": "^2.0.0",
"#angular/compiler": "^2.0.0",
"#angular/core": "^2.0.0",
"#angular/forms": "^2.0.0",
"#angular/http": "^2.0.0",
"#angular/platform-browser": "^2.0.0",
"#angular/platform-browser-dynamic": "^2.0.0",
"#angular/platform-server": "^2.0.0",
"#angular/router": "^3.0.0",
"#types/node": "^6.0.38",
"angular2-platform-node": "~2.0.10",
"angular2-universal": "~2.0.10",
"angular2-universal-polyfills": "~2.0.10",
"aspnet-prerendering": "^1.0.6",
"aspnet-webpack": "^1.0.11",
"bootstrap": "^3.3.7",
"css": "^2.2.1",
"css-loader": "^0.25.0",
"es6-shim": "^0.35.1",
"es7-reflect-metadata": "^1.4.0",
"expose-loader": "^0.7.1",
"extract-text-webpack-plugin": "^1.0.1",
"file-loader": "^0.9.0",
"isomorphic-fetch": "^2.2.1",
"jquery": "^2.2.1",
"preboot": "^4.5.2",
"raw-loader": "^0.5.1",
"rxjs": "5.0.0-beta.12",
"style-loader": "^0.13.0",
"to-string-loader": "^1.1.5",
"ts-loader": "^0.8.2",
"typescript": "^2.0.0",
"url-loader": "^0.5.7",
"webpack": "^1.12.14",
"webpack-externals-plugin": "^1.0.0",
"webpack-hot-middleware": "^2.10.0",
"webpack-merge": "^0.14.1",
"webpack-node-externals": "^1.5.4",
"zone.js": "^0.6.21"
},
"devDependencies": {
"#types/jasmine": "^2.5.35",
"copy-webpack-plugin": "^0.3.3",
"css-loader": "^0.23.0",
"exports-loader": "0.6.2",
"expose-loader": "^0.7.1",
"file-loader": "^0.8.4",
"html-webpack-plugin": "^1.7.0",
"http-server": "^0.8.5",
"imports-loader": "^0.6.4",
"istanbul-instrumenter-loader": "^0.1.3",
"json-loader": "^0.5.3",
"karma": "^0.13.15",
"karma-chrome-launcher": "^0.2.1",
"karma-coverage": "^0.5.3",
"karma-jasmine": "^0.3.6",
"karma-phantomjs-launcher": "^0.2.1",
"karma-sourcemap-loader": "^0.3.6",
"karma-webpack": "1.7.0",
"phantomjs": "^1.9.18",
"phantomjs-polyfill": "0.0.1",
"protractor": "^3.0.0",
"raw-loader": "0.5.1",
"reflect-metadata": "0.1.2",
"remap-istanbul": "^0.5.1",
"rimraf": "^2.4.4",
"style-loader": "^0.13.0",
"ts-helper": "0.0.1",
"ts-loader": "^0.7.2",
"tsconfig-lint": "^0.4.3",
"tslint": "^3.2.0",
"tslint-loader": "^2.1.0",
"typedoc": "^0.3.12",
"typescript": "^1.7.3",
"typings": "^1.4.0",
"url-loader": "^0.5.6",
"webpack": "^1.12.9",
"webpack-dev-server": "^1.12.1",
"webpack-md5-hash": "0.0.4"
}
}
My webpack.config
var isDevBuild = process.argv.indexOf('--env.prod') < 0;
var path = require('path');
var webpack = require('webpack');
var nodeExternals = require('webpack-node-externals');
var merge = require('webpack-merge');
var allFilenamesExceptJavaScript = /\.(?!js(\?|$))([^.]+(\?|$))/;
// Configuration in common to both client-side and server-side bundles
var sharedConfig = {
resolve: { extensions: [ '', '.js', '.ts' ] },
output: {
filename: '[name].js',
publicPath: '/dist/' // Webpack dev middleware, if enabled, handles requests for this URL prefix
},
module: {
loaders: [
{ test: /\.ts$/, include: /ClientApp/, loader: 'ts', query: { silent: true } },
{ test: /\.html$/, loader: 'raw' },
{ test: /\.css$/, loader: 'to-string!css' },
{ test: /\.(png|jpg|jpeg|gif|svg)$/, loader: 'url', query: { limit: 25000 } }
]
}
};
// Configuration for client-side bundle suitable for running in browsers
var clientBundleConfig = merge(sharedConfig, {
entry: { 'main-client': './ClientApp/boot-client.ts' },
output: { path: path.join(__dirname, './wwwroot/dist') },
devtool: isDevBuild ? 'inline-source-map' : null,
plugins: [
new webpack.DllReferencePlugin({
context: __dirname,
manifest: require('./wwwroot/dist/vendor-manifest.json')
})
].concat(isDevBuild ? [] : [
// Plugins that apply in production builds only
new webpack.optimize.OccurenceOrderPlugin(),
new webpack.optimize.UglifyJsPlugin()
])
});
// Configuration for server-side (prerendering) bundle suitable for running in Node
var serverBundleConfig = merge(sharedConfig, {
entry: { 'main-server': './ClientApp/boot-server.ts' },
output: {
libraryTarget: 'commonjs',
path: path.join(__dirname, './ClientApp/dist')
},
target: 'node',
devtool: 'inline-source-map',
externals: [nodeExternals({ whitelist: [allFilenamesExceptJavaScript] })] // Don't bundle .js files from node_modules
});
module.exports = [clientBundleConfig, serverBundleConfig];
Try to use 2.0.0 version
"#angular/common": "2.0.0",
"#angular/compiler": "2.0.0",
"#angular/core": "2.0.0",
"#angular/forms": "2.0.0",
"#angular/http": "2.0.0",
"#angular/platform-browser": "2.0.0",
"#angular/platform-browser-dynamic": "2.0.0",
"#angular/platform-server": "2.0.0"
I think it is some issue with Angular2.1.1
https://github.com/aspnet/JavaScriptServices/issues/406