前端build调整

competitions
杨树明 5 years ago
parent 21eb8a19b5
commit fdab0e6768

@ -7,7 +7,7 @@ const paths = require('./paths');
// Make sure that including paths.js after env.js will read .env variables.
delete require.cache[require.resolve('./paths')];
const NODE_ENV = process.env.NODE_ENV;
const NODE_ENV = "production";
if (!NODE_ENV) {
throw new Error(
'The NODE_ENV environment variable is required but was not specified.'
@ -71,7 +71,7 @@ function getClientEnvironment(publicUrl) {
{
// Useful for determining whether were running in production mode.
// Most importantly, it switches React into the correct mode.
NODE_ENV: process.env.NODE_ENV || 'development',
NODE_ENV: "production",
// Useful for resolving the correct path to static assets in `public`.
// For example, <img src={process.env.PUBLIC_URL + '/img/logo.png'} />.
// This should only be used as an escape hatch. Normally you would put

@ -11,7 +11,6 @@ const SWPrecacheWebpackPlugin = require('sw-precache-webpack-plugin');
const eslintFormatter = require('react-dev-utils/eslintFormatter');
const ModuleScopePlugin = require('react-dev-utils/ModuleScopePlugin');
const ParallelUglifyPlugin = require('webpack-parallel-uglify-plugin');
const paths = require('./paths');
const getClientEnvironment = require('./env');
@ -62,9 +61,16 @@ module.exports = {
// We generate sourcemaps in production. This is slow but gives good results.
// You can exclude the *.map files from the build during deployment.
// devtool: shouldUseSourceMap ? 'nosources-source-map' : false, //正式版
devtool: shouldUseSourceMap ? 'source-map' : false,//测试版
devtool: false,//测试版
// In production, we only want to load the polyfills and the app code.
entry: [require.resolve('./polyfills'), paths.appIndexJs],
// entry: [require.resolve('./polyfills'), paths.appIndexJs],
entry: {
main:[require.resolve('./polyfills'), paths.appIndexJs],
vendor: [
'moment', 'react', 'react-dom','react-router-dom','antd','@icedesign/base','@novnc/novnc','array-flatten','axios',
'material-ui','monaco-editor','react-monaco-editor', 'echarts',"qs"
],
},
output: {
// The build folder.
path: paths.appBuild,
@ -269,6 +275,30 @@ module.exports = {
// In production, it will be an empty string unless you specify "homepage"
// in `package.json`, in which case it will be the pathname of that URL.
new InterpolateHtmlPlugin(env.raw),
new webpack.HashedModuleIdsPlugin(),
// new webpack.optimize.ModuleConcatenationPlugin(),
new webpack.optimize.CommonsChunkPlugin({
async: 'async-vendor',
deepChildren: true,
minChunks: (module) => {
return /node_modules/.test(module.context);
},
}),
new webpack.optimize.CommonsChunkPlugin(
{names: ["vendors", "webpackAssets",'moment', 'react', 'react-dom','react-router-dom','antd','@icedesign/base','@novnc/novnc','array-flatten','axios',
'material-ui','monaco-editor','react-monaco-editor', 'echarts',"qs"]}
),
new webpack.optimize.CommonsChunkPlugin({
name: 'manifest',
minChunks: (module) => {
return /node_modules/.test(module.context);
},
}),
// Generates an `index.html` file with the <script> injected.
new HtmlWebpackPlugin({
inject: true,
@ -317,7 +347,8 @@ module.exports = {
cacheDir: '.cache/',
uglifyJS:{
output: {
comments: false
beautify: true,
comments: true,
},
warnings: false,
compress: {
@ -383,3 +414,4 @@ module.exports = {
child_process: 'empty',
},
};

@ -161,6 +161,7 @@
"devDependencies": {
"@babel/runtime": "7.0.0-beta.51",
"babel-plugin-import": "^1.11.0",
"compression-webpack-plugin": "^1.1.12",
"concat": "^1.0.3",
"happypack": "^5.0.1",
"node-sass": "^4.12.0",

@ -76,10 +76,10 @@ const Otherloginstart=Loadable({
loading: Loading,
})
const TestIndex = Loadable({
loader: () => import('./modules/test'),
loading: Loading,
})
// const TestIndex = Loadable({
// loader: () => import('./modules/test'),
// loading: Loading,
// })
const IndexWrapperComponent = Loadable({
loader: () => import('./modules/page/IndexWrapper'),
@ -91,23 +91,23 @@ const CommentComponent = Loadable({
loading: Loading,
})
const TestMaterialDesignComponent = Loadable({
loader: () => import('./modules/test/md/TestMaterialDesign'),
loading: Loading,
})
const TestCodeMirrorComponent = Loadable({
loader: () => import('./modules/test/codemirror/TestCodeMirror'),
loading: Loading,
})
// const TestMaterialDesignComponent = Loadable({
// loader: () => import('./modules/test/md/TestMaterialDesign'),
// loading: Loading,
// })
// const TestCodeMirrorComponent = Loadable({
// loader: () => import('./modules/test/codemirror/TestCodeMirror'),
// loading: Loading,
// })
const TestComponent = Loadable({
loader: () => import('./modules/test/TestRC'),
loading: Loading,
})
const TestUrlQueryComponent = Loadable({
loader: () => import('./modules/test/urlquery/TestUrlQuery'),
loading: Loading,
})
// const TestComponent = Loadable({
// loader: () => import('./modules/test/TestRC'),
// loading: Loading,
// })
// const TestUrlQueryComponent = Loadable({
// loader: () => import('./modules/test/urlquery/TestUrlQuery'),
// loading: Loading,
// })
const TPMIndexComponent = Loadable({
loader: () => import('./modules/tpm/TPMIndex'),
@ -254,10 +254,10 @@ const Interestpage = Loadable({
})
//众包创新
const ProjectPackages=Loadable({
loader: () => import('./modules/projectPackages/ProjectPackageIndex'),
loading: Loading,
})
// const ProjectPackages=Loadable({
// loader: () => import('./modules/projectPackages/ProjectPackageIndex'),
// loading: Loading,
// })
//竞赛
const NewCompetitions=Loadable({
@ -477,8 +477,8 @@ class App extends Component {
return (<Topicbank {...this.props} {...props} {...this.state} />)
}
}></Route>
{/*众包创新*/}
<Route path={"/crowdsourcing"} component={ProjectPackages}/>
{/*/!*众包创新*!/*/}
{/*<Route path={"/crowdsourcing"} component={ProjectPackages}/>*/}
{/*竞赛*/}
<Route path={"/newcompetitions"} component={NewCompetitions}/>
{/*认证*/}
@ -583,11 +583,11 @@ class App extends Component {
>
</Route>
<Route path="/comment" component={CommentComponent}/>
<Route path="/testMaterial" component={TestMaterialDesignComponent}/>
<Route path="/test" component={TestIndex}/>
<Route path="/testCodeMirror" component={TestCodeMirrorComponent}/>
<Route path="/testRCComponent" component={TestComponent}/>
<Route path="/testUrlQuery" component={TestUrlQueryComponent}/>
{/*<Route path="/testMaterial" component={TestMaterialDesignComponent}/>*/}
{/*<Route path="/test" component={TestIndex}/>*/}
{/*<Route path="/testCodeMirror" component={TestCodeMirrorComponent}/>*/}
{/*<Route path="/testRCComponent" component={TestComponent}/>*/}
{/*<Route path="/testUrlQuery" component={TestUrlQueryComponent}/>*/}
<Route path="/messages"
render={
(props)=>(<Messagerouting {...this.props} {...props} {...this.state}></Messagerouting>)

@ -4,6 +4,11 @@ import { Menu, Icon, List, Avatar,Row, Col,Tag,Pagination} from 'antd';
import axios from 'axios';
import './Competitionsindex.css';
import NoneData from "../../courses/shixunHomework/shixunHomework";
import groups1 from './groups1.png';
import groups2 from './groups2.png';
import groups3 from './groups3.png';
const { SubMenu } = Menu;
@ -105,11 +110,33 @@ class CompetitionsIndex extends Component{
</div>
<div className={"educontent clearfix mtf10 CompetitionsIndex "}>
<style>
{
`
.CompetitionsList{
position: relative;
}
`
}
</style>
<List
className={"CompetitionsList"}
itemLayout="vertical"
size="large"
dataSource={datas&&datas}
renderItem={(item,key) => (
<div>
{item.description===null||item.description===undefined||item.description===""?<style>
{
`
..CompetitionsIndex .ant-list-vertical .ant-list-item-action{
margin-top:50px;
}
`
}
</style>:""}
<img src={groups3} />
<List.Item
key={key}
actions={[
@ -153,7 +180,11 @@ class CompetitionsIndex extends Component{
/>
{item.description}
</List.Item>
)}
</div>
)
}
/>
<div className="mb40 edu-txt-center padding20-30"

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.6 KiB

Loading…
Cancel
Save