Skip to content

Commit f62fd6e

Browse files
authored
Merge pull request #1 from andersinno/anders_customizations
Anders customizations
2 parents 606b651 + 3841fbd commit f62fd6e

File tree

4 files changed

+100
-5
lines changed

4 files changed

+100
-5
lines changed

README.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
# `react-scripts-ts` [![npm version](https://badge.fury.io/js/react-scripts-ts.svg)](https://badge.fury.io/js/react-scripts-ts) [![Build Status](https://travis-ci.org/wmonk/create-react-app-typescript.svg?branch=master)](https://travis-ci.org/wmonk/create-react-app-typescript)
1+
# `react-scripts-ts-ai` [![Build Status](https://travis-ci.org/andersinno/create-react-app-ai.svg?branch=master)](https://travis-ci.org/andersinno/create-react-app-ai)
2+
3+
#### This is a fork of [wmonk/create-react-app-typescript](https://github.com/wmonk/create-react-app-typescript)
24

35
Create React apps (with Typescript) with no build configuration.
46

@@ -9,7 +11,7 @@ _Do you know react and want to try out typescript? Or do you know typescript and
911
```sh
1012
npm install -g create-react-app
1113

12-
create-react-app my-app --scripts-version=react-scripts-ts
14+
create-react-app my-app --scripts-version=react-scripts-ts-ai
1315
cd my-app/
1416
npm start
1517
```

packages/react-scripts/config/webpack.config.dev.js

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -183,13 +183,15 @@ module.exports = {
183183
loader: require.resolve('css-loader'),
184184
options: {
185185
importLoaders: 1,
186+
sourceMap: true,
186187
},
187188
},
188189
{
189190
loader: require.resolve('postcss-loader'),
190191
options: {
191192
// Necessary for external CSS imports to work
192193
// https://github.com/facebookincubator/create-react-app/issues/2677
194+
sourceMap: true,
193195
ident: 'postcss',
194196
plugins: () => [
195197
require('postcss-flexbugs-fixes'),
@@ -207,6 +209,47 @@ module.exports = {
207209
},
208210
],
209211
},
212+
{
213+
test: /\.(sass|scss)$/,
214+
fallback: require.resolve('style-loader'),
215+
use: [
216+
require.resolve('style-loader'),
217+
{
218+
loader: require.resolve('css-loader'),
219+
options: {
220+
importLoaders: 1,
221+
sourceMap: true,
222+
},
223+
},
224+
{
225+
loader: require.resolve('postcss-loader'),
226+
options: {
227+
// Necessary for external CSS imports to work
228+
// https://github.com/facebookincubator/create-react-app/issues/2677
229+
sourceMap: true,
230+
ident: 'postcss',
231+
plugins: () => [
232+
require('postcss-flexbugs-fixes'),
233+
autoprefixer({
234+
browsers: [
235+
'>1%',
236+
'last 4 versions',
237+
'Firefox ESR',
238+
'not ie < 9', // React doesn't support IE8 anyway
239+
],
240+
flexbox: 'no-2009',
241+
}),
242+
],
243+
},
244+
},
245+
{
246+
loader: require.resolve('sass-loader'),
247+
options: {
248+
sourceMap: true,
249+
},
250+
},
251+
],
252+
},
210253
// "file" loader makes sure those assets get served by WebpackDevServer.
211254
// When you `import` an asset, you get its (virtual) filename.
212255
// In production, they would get copied to the `build` folder.

packages/react-scripts/config/webpack.config.prod.js

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -227,6 +227,54 @@ module.exports = {
227227
),
228228
// Note: this won't work without `new ExtractTextPlugin()` in `plugins`.
229229
},
230+
{
231+
test: /\.(sass|scss)$/,
232+
loader: ExtractTextPlugin.extract(
233+
Object.assign(
234+
{
235+
fallback: require.resolve('style-loader'),
236+
use: [
237+
{
238+
loader: require.resolve('css-loader'),
239+
options: {
240+
importLoaders: 1,
241+
minimize: true,
242+
sourceMap: shouldUseSourceMap,
243+
},
244+
},
245+
{
246+
loader: require.resolve('postcss-loader'),
247+
options: {
248+
// Necessary for external CSS imports to work
249+
// https://github.com/facebookincubator/create-react-app/issues/2677
250+
ident: 'postcss',
251+
plugins: () => [
252+
require('postcss-flexbugs-fixes'),
253+
autoprefixer({
254+
browsers: [
255+
'>1%',
256+
'last 4 versions',
257+
'Firefox ESR',
258+
'not ie < 9', // React doesn't support IE8 anyway
259+
],
260+
flexbox: 'no-2009',
261+
}),
262+
],
263+
},
264+
},
265+
{
266+
loader: require.resolve('sass-loader'),
267+
options: {
268+
sourceMap: shouldUseSourceMap,
269+
},
270+
},
271+
],
272+
},
273+
extractTextPluginOptions
274+
)
275+
),
276+
// Note: this won't work without `new ExtractTextPlugin()` in `plugins`.
277+
},
230278
// "file" loader makes sure assets end up in the `build` folder.
231279
// When you `import` an asset, you get its filename.
232280
// This loader don't uses a "test" so it will catch all modules

packages/react-scripts/package.json

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
{
2-
"name": "react-scripts-ts",
2+
"name": "react-scripts-ts-ai",
33
"version": "2.7.0",
44
"description": "Configuration and scripts for Create React App.",
5-
"repository": "wmonk/create-react-app",
5+
"repository": "andersinno/create-react-app-ai",
66
"license": "BSD-3-Clause",
77
"engines": {
88
"node": ">=6"
99
},
1010
"bugs": {
11-
"url": "https://github.com/wmonk/create-react-app/issues"
11+
"url": "https://github.com/andersinno/create-react-app-ai/issues"
1212
},
1313
"files": [
1414
"bin",
@@ -31,11 +31,13 @@
3131
"fs-extra": "3.0.1",
3232
"html-webpack-plugin": "2.29.0",
3333
"jest": "20.0.4",
34+
"node-sass": "^4.5.3",
3435
"object-assign": "4.1.1",
3536
"postcss-flexbugs-fixes": "3.2.0",
3637
"postcss-loader": "2.0.6",
3738
"promise": "8.0.1",
3839
"react-dev-utils": "^4.0.1",
40+
"sass-loader": "^6.0.6",
3941
"style-loader": "0.18.2",
4042
"ts-jest": "^20.0.7",
4143
"ts-loader": "^2.2.1",

0 commit comments

Comments
 (0)