I am using these three css imports from various packages:
// want to do import 'path/to/css.css'
import slickCss from "slick-carousel/slick/slick.css"
import slickCssTheme from "slick-carousel/slick/slick-theme.css"
import leafcss from 'leaflet/dist/leaflet.css'
console.log(`Slick Css: `, slickCss)
console.log(`Slick Theme Css: `, slickCssTheme)
console.log(`leaf css: `, leafcss)
If I log those out they are all empty objects:
Slick Css: {}
Slick Theme Css: {}
leaf css: {}
I assume that something is going wrong with how I am using the loader for webpack. For the most part that I can see everything else is working as far as the react bundle goes. For now I will attach my webpack to not over complicate things. If there is no problem with the webpack I will start adding the necessary files. I tried the alias and still got the same result.
var path = require(`path`)
module.exports = {
mode: `development`,
entry: `./scripts/inject.js`,
output: {
path: path.resolve(__dirname, `dist`),
filename: `bundle.js`,
},
resolve: {
extensions: [`.html`, `.js`, `.json`, `.scss`, `.css`],
alias: {
leafModule: __dirname + `/node_modules/leaflet/dist/leaflet.css`,
},
},
module: {
rules: [
{
test: /\.(png|jpe?g|gif)$/i,
use: [
{
loader: `file-loader`,
},
],
},
{
test: /\.(woff(2)?|ttf|eot|svg)(\?v=\d+\.\d+\.\d+)?$/,
use: [
{
loader: `file-loader`,
options: {
name: `[name].[ext]`,
outputPath: `fonts/`,
},
},
],
},
{
test: /\.css$/i,
use: [`style-loader`, `css-loader`],
},
{
test: /\.js$/,
exclude: /node_modules/,
use: {
loader: `babel-loader`,
options: {
presets: [`@babel/preset-env`],
},
},
},
],
},
}