Coder Social home page Coder Social logo

webpack4-bootstrap4-demo's Introduction

项目适用于哪些人

  • 想使用bootstrap、jquery开发项目,尤其是简单的门户网站,宣传页面等小项目
  • 想学习webpack4配置

    还不知道webpack是干什么的? 它就是一个打包工具,能帮我们压缩代码,处理图片,热启动(开发时修改代码自动刷新浏览器),代码转义(写es6转成es5,写scss转成css)等

如何运行?

  • 确保已安装nodejs,最好是8.x以上,该项目在v8.9.4上测试。

如果不会安装nodejs可以参考这里,如果想安装多个nodejs版本可以参考这里, 如果本地网络不好可以安装cnpm,详情看这里

  • 检出项目到本地
git clone https://github.com/yanxiaojun617/webpack4-bootstrap4-demo.git
  • 进入项目并安装依赖
cd webpack4-bootstrap4-demo
cnpm i
  • 跑起来
npm run dev
  • 运行步骤参考图 运行步骤.png

打包

npm run build

打包后资源放在dist目录下

webpack4-bootstrap4-demo's People

Contributors

xiaosan666 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

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.