catamphetamine / webpack-isomorphic-tools

Server-side rendering for your Webpack-built applications (e.g. React)

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Ability to ignore warnings / errors

RaulTsc opened this issue · comments

Hey, great framework! :)

Would it be possible to add the ability to ignore warnings/errors?

Thanks!

Be more specific

I am currently able to disable debugging with debug: false (which defaults to false).

But I also want to disable warning/error logging. For example when running a node app like

const WebpackIsomorphicTools = require('webpack-isomorphic-tools');
new WebpackIsomorphicTools(require('./src/webpack-isomorphic-tools'))
  .server(rootDir, () => { require('./src/server'); });

I will see a lot of error: asset not found (because it cannot find the key in webassets.json). But I don't have webpack as a dependency and webassets.json is just there so that the server starts (If not it will be stuck saying Waiting for first webpack build.

My specific use case is this:

I have a common-react-components library that I use for the web app but I also want to use components from there in my pdf generation service. In order to do that, I import the components there, and do React.renderToString() to get the html that I pass to wkhtmltopdf to get the pdf.

So in order to not see the errors I need to do this

"{PATH}/Grid/GridList/GridList.scss": {},
    "{PATH}/Grid/GridItem/GridItem.scss": {},
    "{PATH}/Separator/Separator.scss": {},
    "{PATH}/ResponsiveImage/ResponsiveImage.scss": {},
    "{PATH}/Links/Links.scss": {}

Does that make sense?

Thanks!

The entire webpack-assets.json that I use so that I don't have an extra compile step with webpack which I don't need.

{
  "javascript": {
    "main": ""
  },
  "styles": {},
  "assets": {
    "{PATH}/Grid/GridList/GridList.scss": {},
    "{PATH}/Grid/GridItem/GridItem.scss": {},
    "{PATH}/Separator/Separator.scss": {},
    "{PATH}/ResponsiveImage/ResponsiveImage.scss": {},
    "{PATH}/Links/Links.scss": {}
  },
  "webpack": {
    "version": "3.7.1"
  }
}

If it outputs errors then it means that these styles are required somewhere in your components.
You're saying that you don't need styles to generate the PDF.
Why are you using webpack-isomorphic-tools then.

I cannot require the needed components (which don't use scss) because it throws an error that it can't parse scss. Even though I use the full part for the import, I don't import for a common index.ts for example.

In that case you should play with the CSS file type settings:
https://github.com/catamphetamine/webpack-isomorphic-tools#configuration
E.g. set path to return /empty and add /empty to your webpack-assets.json.