Coder Social home page Coder Social logo

wepack_demo's Introduction

本專案為學習使用webpack v4.8.1的練習

[name=仲豪]

1.安裝node,npm

本專案的版本

$npm -v  
//5.6.0
$node -v
//v8.11.1

2.透過npm安裝webpack、webpack loader、webpack-dev-sever

$npm init

按指示初始化 NPM 設定檔 package.json

$npm install --save-dev babel-core babel-eslint babel-loader babel-preset-es2015 babel-preset-react html-webpack-plugin webpack-cli webpack webpack-dev-server

--save-dev 是可以讓你將安裝套件的名稱和版本資訊存放到 package.json,方便日後使用

html-webpack-plugin

簡化HTML文件的創建,以便webpack提供服務,他能自動生成一個html文件並把打包好的js文件放到html (參考網址)

3.在根目錄設定webpack.config.js

4.在根目錄設定.babelrc

5.安裝 react 和 react-dom

$npm install --save-dev react react-dom

6.安裝 style 和 url圖片 的loader文件

$npm install style-loader css-loader url-loader --save-dev

引入loader後,就可以在index.js進入點import引入css或其他靜態資源

7.安裝 sass loader文件

$npm install sass-loader node-sass --save-dev

引入loader後,就可以在index.js進入點import引入scss

wepack_demo's People

Contributors

easonchang0115 avatar

Watchers

 avatar

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.