-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
92205bf
commit a8e01a4
Showing
13 changed files
with
15,129 additions
and
14,977 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,26 +1,11 @@ | ||
{ | ||
"presets": [ | ||
[ | ||
"@babel/preset-env", { | ||
"targets": { | ||
"browsers": ["last 2 versions", "ie >= 10"] | ||
} | ||
} | ||
], | ||
"@babel/preset-env", | ||
"@babel/preset-react" | ||
], | ||
"plugins": [ | ||
"@babel/plugin-syntax-dynamic-import", | ||
"@babel/plugin-proposal-class-properties", | ||
"@babel/plugin-transform-async-to-generator", | ||
["@babel/plugin-proposal-object-rest-spread", { "loose": true, "useBuiltIns": true }], | ||
[ | ||
"@babel/plugin-transform-runtime", { | ||
"corejs": false, | ||
"helpers": true, | ||
"regenerator": true, | ||
"useESModules": false | ||
} | ||
] | ||
"@babel/plugin-transform-async-to-generator" | ||
] | ||
} |
This file was deleted.
Oops, something went wrong.
20 changes: 13 additions & 7 deletions
20
example/simple/scripts/conf/path.js → example/simple/config/paths.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,24 @@ | ||
|
||
|
||
const path = require('path'); | ||
const fs = require('fs'); | ||
|
||
|
||
// Make sure any symlinks in the project folder are resolved: | ||
// https://github.com/facebookincubator/create-react-app/issues/637 | ||
const appDirectory = fs.realpathSync(process.cwd()); | ||
const resolveApp = relativePath => path.resolve(appDirectory, relativePath); | ||
|
||
console.log('>>>', path.resolve(__dirname, '../public')) | ||
console.log('>>>222', resolveApp('public')) | ||
|
||
module.exports = { | ||
appBuildDist: resolveApp('dist'), | ||
// Source files | ||
src: resolveApp('src'), | ||
|
||
// Production build files | ||
build: resolveApp('dist'), | ||
|
||
// Static files that get copied to build folder | ||
public: resolveApp('public'), | ||
appHtml: resolveApp('public/index.html'), | ||
appIndexJs: resolveApp('src/index.js'), | ||
// appFavicon: resolveApp('public/favicon.png'), | ||
appFavicon: resolveApp('public/favicon.ico'), | ||
appSrc: resolveApp('src'), | ||
} | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
const paths = require('./paths'); | ||
|
||
const { CleanWebpackPlugin } = require('clean-webpack-plugin'); | ||
const HtmlWebpackPlugin = require('html-webpack-plugin'); | ||
|
||
module.exports = { | ||
// Where webpack looks to start building the bundle | ||
entry: [`${paths.src}/index.js`], | ||
|
||
// Where webpack outputs the assets and bundles | ||
output: { | ||
path: paths.build, | ||
filename: '[name].bundle.js', | ||
publicPath: '/', | ||
}, | ||
|
||
// Customize the webpack build process | ||
plugins: [ | ||
// Removes/cleans build folders and unused assets when rebuilding | ||
new CleanWebpackPlugin(), | ||
new HtmlWebpackPlugin({ | ||
favicon: paths.appFavicon, | ||
inject: true, | ||
template: paths.appHtml, | ||
}), | ||
], | ||
|
||
// Determine how modules within the project are treated | ||
module: { | ||
rules: [ | ||
// JavaScript: Use Babel to transpile JavaScript files | ||
{ test: /\.js$/, exclude: /node_modules/, use: ['babel-loader'] }, | ||
], | ||
}, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
const paths = require('./paths') | ||
|
||
const webpack = require('webpack') | ||
const { merge } = require('webpack-merge') | ||
const common = require('./webpack.common.js') | ||
|
||
module.exports = merge(common, { | ||
// Set the mode to development or production | ||
mode: 'development', | ||
// Control how source maps are generated | ||
devtool: 'inline-source-map', | ||
// Spin up a server for quick development | ||
devServer: { | ||
historyApiFallback: true, | ||
contentBase: paths.build, | ||
open: true, | ||
compress: true, | ||
hot: true, | ||
port: 8082, | ||
}, | ||
plugins: [ | ||
// Only update what has changed on hot reload | ||
new webpack.HotModuleReplacementPlugin(), | ||
], | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
const paths = require('./paths'); | ||
const { merge } = require('webpack-merge'); | ||
const common = require('./webpack.common.js'); | ||
|
||
module.exports = merge(common, { | ||
mode: 'production', | ||
devtool: false, | ||
output: { | ||
path: paths.build, | ||
publicPath: '/', | ||
filename: 'js/[name].[contenthash].bundle.js', | ||
}, | ||
optimization: { | ||
minimize: true, | ||
minimizer: ["..."], | ||
// Once your build outputs multiple chunks, this option will ensure they share the webpack runtime | ||
// instead of having their own. This also helps with long-term caching, since the chunks will only | ||
// change when actual code changes, not the webpack runtime. | ||
runtimeChunk: { | ||
name: 'runtime', | ||
}, | ||
}, | ||
performance: { | ||
hints: false, | ||
maxEntrypointSize: 512000, | ||
maxAssetSize: 512000, | ||
}, | ||
}) |
Oops, something went wrong.