Giter Club home page Giter Club logo

webpack4-bootstrap4-demo's Issues

多级静态资源路径问题求解

看了你的webpack配置,觉得很不错!不过,请教如何配置多级静态资源路径?
如,assets/img目录下存在多个子目录,如assets/img/sub1, assets/img/sub2,在html模板中引用了子目录assets/img/sub1下的图片后,发现页面的该图片无法正常显示,并且打包也无法将打包这些子目录。如果只是打包的问题,我想可以用copy-webpack-plugin插件来集中拷贝静态资源。但是还是无法解决上述显示问题。

运行npm run dev后报错

PS C:\txh\html\webpack4-bootstrap4-demo-master> npm run dev

[email protected] dev C:\txh\html\webpack4-bootstrap4-demo-master
cross-env NODE_ENV=dev webpack-dev-server --config webpack.config.js --progress

module.js:550
throw err;
^

Error: Cannot find module 'locate-path'
at Function.Module._resolveFilename (module.js:548:15)
at Function.Module._load (module.js:475:25)
at Module.require (module.js:597:17)
at require (internal/module.js:11:18)
at Object. (C:\txh\html\webpack4-bootstrap4-demo-master\node_modules_find-up@3.0.0@find-up\index.js:3:20)
at Module._compile (module.js:653:30)
at Object.Module._extensions..js (module.js:664:10)
at Module.load (module.js:566:32)
at tryModuleLoad (module.js:506:12)
at Function.Module._load (module.js:498:3)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] dev: cross-env NODE_ENV=dev webpack-dev-server --config webpack.config.js --progress
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] dev script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\HUIPC\AppData\Roaming\npm-cache_logs\2019-03-07T19_28_08_081Z-debug.log

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.