kamranahmedse / driver.js

A light-weight, no-dependency, vanilla JavaScript engine to drive the user's focus across the page

Home Page:https://driverjs.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Module build failed

maksam07 opened this issue · comments

Hi! When I use the import from the documentation:

import { driver } from "driver.js";
import "driver.js/dist/driver.css";

it's all working properly. But if I import the css file into my css:

//js file
import './css/style.css';
import {driver} from 'driver.js';

//style.css
@import 'driver.js/dist/driver.css';

I'm getting an error:

ERROR in ./src/css/style.css (./src/css/style.css.webpack[javascript/auto]!=!./node_modules/css-loader/dist/cjs.js!./node_modules/postcss-loader/dist/cjs.js!./node_modules/sass-loader/dist/cjs.js!./src/css/style.css)
Module build failed (from ./node_modules/css-loader/dist/cjs.js):
Error: Package path ./dist/driver.css is not exported from package /.../node_modules/driver.js (see exports field in /.../node_modules/driver.js/package.json)

I don't understand what to do about it. I already have about 5 different modules imported and just now this problem started. Or is it not possible to do your module import in my css?

I have de same error in Angular 15

./src/global.scss - Error: Module build failed (from ./node_modules/css-loader/dist/cjs.js):
./src/global.scss?ngGlobalStyle - Error: Module build failed (from ./node_modules/mini-css-extract-plugin/dist/loader.js):

Same error here in Angular 16.

However, the css is really simple and I copy it to a single css file in my project , and it works.

@wangzhigang1999 I don't think it's the right solution but it worked for me to be able to continue. thanks.

However, the css is really simple and I copy it to a single css file in my project , and it works.

Of course, you can use this solution too, but the webpack is designed for... less manual work. When the module update comes out, I'll have to remember to move the styles into my file again. This solution is not very good, but of course it can exist