Skip to content

Commit 80d7347

Browse files
author
Nicolás Martinez
committed
Added url and file to webpack config
1 parent f744843 commit 80d7347

File tree

6 files changed

+30
-11
lines changed

6 files changed

+30
-11
lines changed

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
1-
/node_modules
1+
npm-debug.log
2+
node_modules/

build/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -184,7 +184,7 @@ exports = module.exports = __webpack_require__(5)(undefined);
184184

185185

186186
// module
187-
exports.push([module.i, ".my-component {\n background-color: #c3dfb7;\n height: 200px; }\n", ""]);
187+
exports.push([module.i, ".my-component {\n height: 200px; }\n", ""]);
188188

189189
// exports
190190

package.json

Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,29 @@
11
{
2-
"name": "nico-component",
3-
"version": "0.0.1",
4-
"description": "NPM test component",
2+
"name": "npm-react-component-starter",
3+
"version": "1.0.0",
4+
"description": "Base project for creating React components and publish them to npm",
55
"main": "build/index.js",
66
"peerDependencies": {
77
"react": "^16.0.0"
88
},
9+
"repository": {
10+
"type": "git",
11+
"url": "git@github.com:nmartinezb3/npm-react-component-starter.git"
12+
},
13+
"bugs": {
14+
"url": "git@github.com:nmartinezb3/npm-react-component-starter.git"
15+
},
916
"scripts": {
1017
"start": "webpack --watch",
1118
"build": "webpack",
1219
"test": "echo \"Error: no test specified\" && exit 1"
1320
},
21+
"keywords": [
22+
"react-component",
23+
"react",
24+
"webpack",
25+
"npm"
26+
],
1427
"author": "Nicolás Martínez",
1528
"license": "ISC",
1629
"devDependencies": {
@@ -21,9 +34,11 @@
2134
"babel-plugin-transform-react-jsx": "^6.24.1",
2235
"babel-preset-env": "^1.6.0",
2336
"css-loader": "^0.28.7",
37+
"file-loader": "^1.1.3",
2438
"node-sass": "^4.5.3",
2539
"sass-loader": "^6.0.6",
26-
"style-loader": "^0.18.2"
40+
"style-loader": "^0.18.2",
41+
"url-loader": "^0.5.9"
2742
},
2843
"dependencies": {
2944
"react": "^16.0.0",

src/components/MyComponent.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import React from 'react';
22
import '../styles/MyComponent.scss'
3-
43
class MyComponent extends React.Component {
54

65
render() {

src/styles/MyComponent.scss

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,3 @@
1-
$color: #c3dfb7;
2-
31
.my-component {
4-
background-color: $color;
52
height: 200px;
63
}

webpack.config.js

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,14 @@ module.exports = {
1717
{
1818
test: /\.scss$/,
1919
loaders: ['style-loader', 'css-loader', 'sass-loader']
20-
}
20+
},
21+
{
22+
test: /\.(jpg|png|gif)$/,
23+
loader: 'url-loader',
24+
options: {
25+
limit: 25000,
26+
},
27+
},
2128
],
2229
},
2330
externals: {

0 commit comments

Comments
 (0)