Monday, May 18, 2020

Webpack file loaders to use pdf and image from outside project folder in react


After changes done in webpack.config file just re-run by npm start the project so that webpack-dev-server will start with new changes.

We can access image files or pdf files located inside project or outside project in react Project

to access the pdf files u need to have pdf file loader in webpack.config file

import Pdf from './sample.pdf'; Open Pdf files

To access image files u need to have image file loader in webpack.config file

import image from './sample.pdf'; ""

No comments:

Post a Comment