Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
585 views
in Technique[技术] by (71.8m points)

javascript - Problem in importing chessboard.js in vue application

I am trying to import chessboard.js on my jetstream-vue application. After creating the project I ran npm install @chrisoakman/chessboardjs and it's in my node_modules folder. But when i tried import Chessboard from '@chrisoakman/chessboardjs' on app.js it shows error as

ERROR in ./resources/js/app.js
Module not found: Error: Can't resolve '@chrisoakman/chessboardjs' in '/home/user/project-chess/resources/js'
 @ ./resources/js/app.js 9:0-51
 @ multi ./resources/js/app.js ./resources/css/app.css

Is there any other way I should try to import it or from to a different file than app.js.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

@chrisoakman/chessboardjs can't be imported, since it doesn't export anything.

Look at the code, at the end it says:

  // TODO: do module exports here

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

2.1m questions

2.1m answers

60 comments

57.0k users

...