mirror of
https://github.com/aspnet/JavaScriptServices.git
synced 2025-12-22 17:47:53 +00:00
Change WebApplicationBasic template to use web pack vendor DLL and to load CSS as a file (not via JS). Also remove Babel as it's not doing anything here.
This commit is contained in:
@@ -5,9 +5,8 @@
|
|||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||||
<title>@ViewData["Title"] - WebApplicationBasic</title>
|
<title>@ViewData["Title"] - WebApplicationBasic</title>
|
||||||
|
|
||||||
<environment names="Staging,Production">
|
<link rel="stylesheet" href="~/dist/vendor.css" asp-append-version="true" />
|
||||||
<link rel="stylesheet" href="~/dist/site.css" />
|
<link rel="stylesheet" href="~/dist/site.css" asp-append-version="true" />
|
||||||
</environment>
|
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<div class="navbar navbar-inverse navbar-fixed-top">
|
<div class="navbar navbar-inverse navbar-fixed-top">
|
||||||
|
|||||||
@@ -2,8 +2,6 @@
|
|||||||
"name": "WebApplicationBasic",
|
"name": "WebApplicationBasic",
|
||||||
"version": "0.0.0",
|
"version": "0.0.0",
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"babel-loader": "^6.2.3",
|
|
||||||
"babel-preset-es2015": "^6.5.0",
|
|
||||||
"bootstrap": "^3.3.6",
|
"bootstrap": "^3.3.6",
|
||||||
"css-loader": "^0.23.1",
|
"css-loader": "^0.23.1",
|
||||||
"extendify": "^1.0.0",
|
"extendify": "^1.0.0",
|
||||||
@@ -15,8 +13,5 @@
|
|||||||
"typescript": "^1.8.2",
|
"typescript": "^1.8.2",
|
||||||
"url-loader": "^0.5.7",
|
"url-loader": "^0.5.7",
|
||||||
"webpack": "^1.12.14"
|
"webpack": "^1.12.14"
|
||||||
},
|
|
||||||
"dependencies": {
|
|
||||||
"babel-core": "^6.5.2"
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -42,8 +42,9 @@
|
|||||||
"**.vspscc"
|
"**.vspscc"
|
||||||
],
|
],
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"prepublish": [
|
"prepare": [
|
||||||
"npm install",
|
"npm install",
|
||||||
|
"webpack --config webpack.config.vendor.js",
|
||||||
"webpack"
|
"webpack"
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"compilerOptions": {
|
"compilerOptions": {
|
||||||
"moduleResolution": "node",
|
"moduleResolution": "node",
|
||||||
"target": "es6",
|
"target": "es5",
|
||||||
"sourceMap": true
|
"sourceMap": true
|
||||||
},
|
},
|
||||||
"exclude": [
|
"exclude": [
|
||||||
|
|||||||
@@ -1,8 +1,3 @@
|
|||||||
module.exports = {
|
module.exports = {
|
||||||
devtool: 'inline-source-map',
|
devtool: 'inline-source-map'
|
||||||
module: {
|
|
||||||
loaders: [
|
|
||||||
{ test: /\.css/, loader: 'style!css' }
|
|
||||||
]
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -1,9 +1,11 @@
|
|||||||
var path = require('path');
|
var path = require('path');
|
||||||
var webpack = require('webpack');
|
var webpack = require('webpack');
|
||||||
|
var ExtractTextPlugin = require('extract-text-webpack-plugin');
|
||||||
var merge = require('extendify')({ isDeep: true, arrays: 'concat' });
|
var merge = require('extendify')({ isDeep: true, arrays: 'concat' });
|
||||||
var devConfig = require('./webpack.config.dev');
|
var devConfig = require('./webpack.config.dev');
|
||||||
var prodConfig = require('./webpack.config.prod');
|
var prodConfig = require('./webpack.config.prod');
|
||||||
var isDevelopment = process.env.ASPNET_ENV === 'Development';
|
var isDevelopment = process.env.ASPNET_ENV === 'Development';
|
||||||
|
var extractCSS = new ExtractTextPlugin('site.css');
|
||||||
|
|
||||||
module.exports = merge({
|
module.exports = merge({
|
||||||
resolve: {
|
resolve: {
|
||||||
@@ -11,14 +13,12 @@ module.exports = merge({
|
|||||||
},
|
},
|
||||||
module: {
|
module: {
|
||||||
loaders: [
|
loaders: [
|
||||||
{ test: /\.ts(x?)$/, include: /ClientApp/, loader: 'babel-loader' },
|
|
||||||
{ test: /\.ts(x?)$/, include: /ClientApp/, loader: 'ts-loader' },
|
{ test: /\.ts(x?)$/, include: /ClientApp/, loader: 'ts-loader' },
|
||||||
{ test: /\.(png|woff|woff2|eot|ttf|svg)$/, loader: 'url-loader?limit=100000' }
|
{ test: /\.css/, loader: extractCSS.extract(['css']) }
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
entry: {
|
entry: {
|
||||||
main: ['./ClientApp/App.ts'],
|
main: ['./ClientApp/App.ts']
|
||||||
vendor: ['bootstrap', 'bootstrap/dist/css/bootstrap.css', 'style-loader', 'jquery']
|
|
||||||
},
|
},
|
||||||
output: {
|
output: {
|
||||||
path: path.join(__dirname, 'wwwroot', 'dist'),
|
path: path.join(__dirname, 'wwwroot', 'dist'),
|
||||||
@@ -26,8 +26,10 @@ module.exports = merge({
|
|||||||
publicPath: '/dist/'
|
publicPath: '/dist/'
|
||||||
},
|
},
|
||||||
plugins: [
|
plugins: [
|
||||||
new webpack.ProvidePlugin({ $: 'jquery', jQuery: 'jquery' }), // Maps these identifiers to the jQuery package (because Bootstrap expects it to be a global variable)
|
extractCSS,
|
||||||
new webpack.optimize.OccurenceOrderPlugin(),
|
new webpack.DllReferencePlugin({
|
||||||
new webpack.optimize.CommonsChunkPlugin('vendor', 'vendor.js') // Moves vendor content out of other bundles
|
context: __dirname,
|
||||||
|
manifest: require('./wwwroot/dist/vendor-manifest.json')
|
||||||
|
})
|
||||||
]
|
]
|
||||||
}, isDevelopment ? devConfig : prodConfig);
|
}, isDevelopment ? devConfig : prodConfig);
|
||||||
|
|||||||
@@ -1,15 +1,8 @@
|
|||||||
var webpack = require('webpack');
|
var webpack = require('webpack');
|
||||||
var ExtractTextPlugin = require('extract-text-webpack-plugin');
|
|
||||||
var extractCSS = new ExtractTextPlugin('site.css');
|
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
module: {
|
|
||||||
loaders: [
|
|
||||||
{ test: /\.css/, loader: extractCSS.extract(['css']) },
|
|
||||||
]
|
|
||||||
},
|
|
||||||
plugins: [
|
plugins: [
|
||||||
extractCSS,
|
new webpack.optimize.OccurenceOrderPlugin(),
|
||||||
new webpack.optimize.UglifyJsPlugin({ minimize: true })
|
new webpack.optimize.UglifyJsPlugin({ minimize: true })
|
||||||
]
|
]
|
||||||
};
|
};
|
||||||
|
|||||||
36
templates/WebApplicationBasic/webpack.config.vendor.js
Normal file
36
templates/WebApplicationBasic/webpack.config.vendor.js
Normal file
@@ -0,0 +1,36 @@
|
|||||||
|
var path = require('path');
|
||||||
|
var webpack = require('webpack');
|
||||||
|
var ExtractTextPlugin = require('extract-text-webpack-plugin');
|
||||||
|
var extractCSS = new ExtractTextPlugin('vendor.css');
|
||||||
|
var isDevelopment = process.env.ASPNET_ENV === 'Development';
|
||||||
|
|
||||||
|
module.exports = {
|
||||||
|
resolve: {
|
||||||
|
extensions: [ '', '.js' ]
|
||||||
|
},
|
||||||
|
module: {
|
||||||
|
loaders: [
|
||||||
|
{ test: /\.(png|woff|woff2|eot|ttf|svg)$/, loader: 'url-loader?limit=100000' },
|
||||||
|
{ test: /\.css/, loader: extractCSS.extract(['css']) }
|
||||||
|
]
|
||||||
|
},
|
||||||
|
entry: {
|
||||||
|
vendor: ['bootstrap', 'bootstrap/dist/css/bootstrap.css', 'style-loader', 'jquery']
|
||||||
|
},
|
||||||
|
output: {
|
||||||
|
path: path.join(__dirname, 'wwwroot', 'dist'),
|
||||||
|
filename: '[name].js',
|
||||||
|
library: '[name]_[hash]',
|
||||||
|
},
|
||||||
|
plugins: [
|
||||||
|
extractCSS,
|
||||||
|
new webpack.ProvidePlugin({ $: 'jquery', jQuery: 'jquery' }), // Maps these identifiers to the jQuery package (because Bootstrap expects it to be a global variable)
|
||||||
|
new webpack.optimize.OccurenceOrderPlugin(),
|
||||||
|
new webpack.DllPlugin({
|
||||||
|
path: path.join(__dirname, 'wwwroot', 'dist', '[name]-manifest.json'),
|
||||||
|
name: '[name]_[hash]'
|
||||||
|
})
|
||||||
|
].concat(isDevelopment ? [] : [
|
||||||
|
new webpack.optimize.UglifyJsPlugin({ compress: { warnings: false } })
|
||||||
|
])
|
||||||
|
};
|
||||||
Reference in New Issue
Block a user