Skip to content

Commit

Permalink
feat:更新配置和文档
Browse files Browse the repository at this point in the history
  • Loading branch information
SOALIN228 committed Jan 5, 2020
1 parent c3ae7e5 commit 6bf39b7
Show file tree
Hide file tree
Showing 6 changed files with 60 additions and 24 deletions.
26 changes: 26 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
module.exports = {
parser: 'babel-eslint',
env: {
browser: true,
es6: true
},
extends: [
'plugin:react/recommended',
'standard'
],
globals: {
Atomics: 'readonly',
SharedArrayBuffer: 'readonly'
},
parserOptions: {
ecmaFeatures: {
jsx: true
},
ecmaVersion: 2018,
sourceType: 'module'
},
plugins: [
'react'
],
rules: {}
}
20 changes: 0 additions & 20 deletions .eslintrc.json

This file was deleted.

31 changes: 31 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -314,6 +314,19 @@ document.addEventListener('click', () => {



## resolve

```js
resolve: {
extensions: ['.js', '.jsx'], // 安装设置进行文件尾缀匹配
alias: { // 全局变量
'@': path.resolve(__dirname, '../src')
}
}
```



## Loader

在 webpack.dev.js 文件 module 中配置
Expand Down Expand Up @@ -553,6 +566,24 @@ plugins: [
]
```

### 目录拷贝

将单个文件或整个目录复制到构建目录

```bash
npm install copy-webpack-plugin -D
```

```js
new CopyWebpackPlugin([
{
from: path.resolve(__dirname, '../static'),
to: 'static',
ignore: ['.*']
}
])
```



## babel
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@
"eslint-plugin-import": "^2.19.1",
"eslint-plugin-node": "^11.0.0",
"eslint-plugin-promise": "^4.2.1",
"eslint-plugin-react": "^7.17.0",
"eslint-plugin-standard": "^4.0.1",
"file-loader": "^5.0.2",
"html-webpack-plugin": "^3.2.0",
Expand Down
2 changes: 1 addition & 1 deletion src/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<html lang="zh-CN">
<head>
<meta charset="UTF-8">
<title>webpack</title>
<title>noCLI</title>
</head>
<body>
<div id="root"></div>
Expand Down
4 changes: 1 addition & 3 deletions src/index.js
Original file line number Diff line number Diff line change
@@ -1,14 +1,12 @@
// eslint-disable-next-line no-unused-vars
import React, { Component } from 'react'
import ReactDom from 'react-dom'
import _ from 'lodash'

// eslint-disable-next-line no-unused-vars
class App extends Component {
render () {
return (
<div>
<div>{_.join(['this', 'is', 'main'], ' ')}</div>
<div>{_.join(['welcome', 'to', 'noCLI'], ' ')}</div>
</div>
)
}
Expand Down

0 comments on commit 6bf39b7

Please sign in to comment.