babel-plugin-react-css-modules import is not work in less-loader - babel-plugin-react-css-modules

i try use #import is not working。
// a.less
.hello{width:100px;height:100px;background:blue;}
// index.less
#import './a.less'
// App.jsx
import './index.less';
<div styleName="hello"></div>
ERROR:
ERROR in ./src/App.jsx
Module build failed: Error: D:/workspace_js/react-redux-boilerplate/src/App.jsx: Could not resolve the styleName 'hello'.
at styleNameValue.split.filter.map.styleName (D:\workspace_js\react-redux-boilerplate\node_modules\babel-plugin-react-css-modules\dist\getClassNam
e.js:83:15)
at Array.map (<anonymous>)
at exports.default (D:\workspace_js\react-redux-boilerplate\node_modules\babel-plugin-react-css-modules\dist\getClassName.js:66:6)
at exports.default (D:\workspace_js\react-redux-boilerplate\node_modules\babel-plugin-react-css-modules\dist\resolveStringLiteral.js:27:56)
at PluginPass.JSXElement (D:\workspace_js\react-redux-boilerplate\node_modules\babel-plugin-react-css-modules\dist\index.js:183:46)
at newFn (D:\workspace_js\react-redux-boilerplate\node_modules\babel-traverse\lib\visitors.js:276:21)
at NodePath._call (D:\workspace_js\react-redux-boilerplate\node_modules\babel-traverse\lib\path\context.js:76:18)
at NodePath.call (D:\workspace_js\react-redux-boilerplate\node_modules\babel-traverse\lib\path\context.js:48:17)
at NodePath.visit (D:\workspace_js\react-redux-boilerplate\node_modules\babel-traverse\lib\path\context.js:105:12)
at TraversalContext.visitQueue (D:\workspace_js\react-redux-boilerplate\node_modules\babel-traverse\lib\context.js:150:16)
at TraversalContext.visitMultiple (D:\workspace_js\react-redux-boilerplate\node_modules\babel-traverse\lib\context.js:103:17)
at TraversalContext.visit (D:\workspace_js\react-redux-boilerplate\node_modules\babel-traverse\lib\context.js:190:19)
at Function.traverse.node (D:\workspace_js\react-redux-boilerplate\node_modules\babel-traverse\lib\index.js:114:17)
at NodePath.visit (D:\workspace_js\react-redux-boilerplate\node_modules\babel-traverse\lib\path\context.js:115:19)
at TraversalContext.visitQueue (D:\workspace_js\react-redux-boilerplate\node_modules\babel-traverse\lib\context.js:150:16)
at TraversalContext.visitSingle (D:\workspace_js\react-redux-boilerplate\node_modules\babel-traverse\lib\context.js:108:19)
# ./src/index.jsx 14:0-24 28:2-30:4 28:29-30:3
# multi webpack-hot-middleware/client?reload=true react-hot-loader/patch webpack/hot/only-dev-server ./src/index.jsx
this is test demo : git#github.com:ganxunzou/react-redux-boilerplate.git
test setp:
clone git#github.com:ganxunzou/react-redux-boilerplate.git
git checkout css-module-less-postcss
npm i
npm run dev

try use #import is not working。
Mentioned error can be caused by different factors. Firstly, provided webpack.config does not include any loader for .less css-files, so ensure to add appropriate loader into config: https://github.com/webpack-contrib/less-loader
Secondly, styles can be wrapped in independent namespaces, which is useful to avoid collisions between components - so ensure, that generated scope is used property

Related

How to parameterize the Branch name and load the shared library implicitly

I want to parameterize the Branch name and load the shared library implicitly.
#Library('my-shared-library/$BRANCH_NAME') _
I am getting the following error message.
'''
org.jenkinsci.plugins.workflow.cps.CpsCompilationErrorsException: startup failed:
Script1.groovy: #Library value ‘my-shared-library#$BRANCH_NAME’ was not a constant; did you mean to use the ‘library’ step instead?
1 error
at org.codehaus.groovy.control.ErrorCollector.failIfErrors(ErrorCollector.java:310)
at org.codehaus.groovy.control.CompilationUnit.applyToPrimaryClassNodes(CompilationUnit.java:1085)
at org.codehaus.groovy.control.CompilationUnit.doPhaseOperation(CompilationUnit.java:603)
at org.codehaus.groovy.control.CompilationUnit.processPhaseOperations(CompilationUnit.java:581)
at org.codehaus.groovy.control.CompilationUnit.compile(CompilationUnit.java:558)
at groovy.lang.GroovyClassLoader.doParseClass(GroovyClassLoader.java:298)
'''
Is there any way I can pass the parameter only in the shared library implicitly?
There are two options for loading Shared Libraries, Static loading that occurs before the pipeline script is executed using the #Library keyword, and dynamic loading using the library.
While is static loading you can't use parameters, in dynamic loading you can do so:
As of version 2.7 of the Pipeline: Shared Groovy Libraries plugin, there is a new option for loading (non-implicit) libraries in a script: a library step that loads a library dynamically, at any time during the build.
library 'my-shared-library'
Regarding versions in dynamic libraries:
When using the library step you may also specify a version:
library 'my-shared-library#master'.
Since this is a regular step, that version could be computed rather than a
constant as with the annotation;
For example:
library "my-shared-library#$BRANCH_NAME"

StyleFrame (or styleframe?) import issue

This is not a deal breaker but I used to import this library via "import StyleFrame", but now it throws the error:
ModuleNotFoundError: No module named 'StyleFrame'
Switching from "import StyleFrame" to "import styleframe" fixes the problem, but just wanted to know if this was done intentionally by the creator?
Yes, it was done intentionally and is mentioned in the changelog as one of the changes between versions 2.X and 3.X:
3.0.1
...
Renamed package name to styleframe (all lowercase) in accordance of
PEP8
...

rails webpack-dev-server "Invalid configuration object"

When I try to run ./bin/webpack-dev-server I get this:
Invalid configuration object. Webpack has been initialised using a configuration object that does not match the API schema.
- configuration has an unknown property 'mode'. These properties are valid:
object { amd?, bail?, cache?, context?, dependencies?, devServer?, devtool?, entry, externals?, loader?, module?, name?, node?, output?, parallelism?, performance?, plugins?, profile?, recordsInputPath?, recordsOutputPath?, recordsPath?, resolve?, resolveLoader?, stats?, target?, watch?, watchOptions? }
For typos: please correct them.
For loader options: webpack 2 no longer allows custom properties in configuration.
Loaders should be updated to allow passing options via loader options in module.rules.
Until loaders are updated one can use the LoaderOptionsPlugin to pass these options to the loader:
plugins: [
new webpack.LoaderOptionsPlugin({
// test: /\.xxx$/, // may apply this only for some modules
options: {
mode: ...
}
})
]
I'm pretty sure this is yarn messing up with package versions. Is there a "reinstall everything" command I can run?
My versions are
webpack-dev-server#3.4.1
#rails/webpacker#3.5.5
Most likely a problems with webpacker.yml.
In my case source_path was incorrect.
See this: Invalid configuration object when starting webpack-dev-server

RollupJS: Unresolved internal dependency

I'm getting an error that looks like it's unable to resolve my import to my other module.
Running rollup -c I'm getting the following error
(!) Unresolved dependencies
https://github.com/rollup/rollup/wiki/Troubleshooting#treating-module-as-external-dependency
components/main/view (imported by src\index.js)
(!) Missing global variable name
Use output.globals to specify browser global variable names corresponding to external modules
C:\Users\n88040\AppData\Roaming\npm\node_modules\rollup\dist\rollup.js (guessing 'View')
src/index.js
import View from 'components/main/view`;
View();
src/components/main/view.js
const View = () => console.log('foo');
export default View;
See https://rollupjs.org/guide/en#es-module-syntax
You have to import local dependencies with a leading period as otherwise it will be interpreted as an external dependency:
import View from './components/main/view';

Is there a groovyws.jar with all his dependences?

I'm using Grails and want to use groovyws to call an web-service.
But my groovyws.jar (0.5.2) have MANY dependences that I can't solve.
Is there any jar with all dependences included?
Note: I tried put in BuildConfig.groovy, this
dependencies {
'org.codehaus.groovy.modules:groovyws:0.5.2'
}
but I'm getting error:
Error executing script Compile: loader constraint violation: when
resolving overridden method
"org.apache.xerces.jaxp.SAXParserImpl.getParser()Lorg/xml/sax/Parser;"
the class loader (instance of
org/codehaus/groovy/grails/cli/support/GrailsRootLoader) of the
current class, org/apache/xerces/jaxp/SAXParserImpl, and its
superclass loader (instance of ), have different Class
objects for the type org/xml/sax/Parser used in the signature
You can manually exclude xerces by:
dependencies {
runtime('org.codehaus.groovy.modules:groovyws:0.5.2') {
exclude: 'xerces'
}
}
GroovyWS pulls inn CXF, which again pulls in a lot of dependencies, some of them conflicting with classes already present in Java 6. You need to exclude all these dependencies if using Java 6, to avoid errors like the one you mention.
Here's my exclude list:
compile("org.codehaus.groovy.modules:groovyws:0.5.2") {
excludes 'geronimo-servlet_2.5_spec', 'servlet-api', 'jaxb-xjc', 'jaxb-impl', 'xml-apis', 'saaj-impl', 'junit', 'slf4j-jdk14', 'xmlParserAPIs', 'jaxb-api', 'saaj-api', 'xmlbeans', 'jaxen', 'geronimo-stax-api_1.0_spec', 'geronimo-activation_1.0.2_spec', 'abdera-client', 'geronimo-activation_1.1_spec'
}
Note that on Ubuntu you need jaxb-xjc and jaxb-impl after all, don't know why.
I found:
http://docs.codehaus.org/dosearchsite.action?queryString=groovyws+standalone
Tks a lot!
(search for "groovyws standalone")
Note: I saw this tip here.

Resources