-
Notifications
You must be signed in to change notification settings - Fork 61
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
a920a7e
commit 127d723
Showing
28 changed files
with
384 additions
and
511 deletions.
There are no files selected for viewing
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 @@ | ||
--ignore-dir=dist |
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
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
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 |
---|---|---|
@@ -0,0 +1,35 @@ | ||
const path = require('path') | ||
const webpack = require('webpack') | ||
const MFS = require('memory-fs') | ||
const clientConfig = require('./webpack.client.config') | ||
const serverConfig = require('./webpack.server.config') | ||
|
||
module.exports = function setupDevServer (app, onUpdate) { | ||
clientConfig.entry.app = ['webpack-hot-middleware/client', clientConfig.entry.app] | ||
clientConfig.plugins.push( | ||
new webpack.HotModuleReplacementPlugin(), | ||
new webpack.NoErrorsPlugin() | ||
) | ||
|
||
const clientCompiler = webpack(clientConfig) | ||
app.use(require('webpack-dev-middleware')(clientCompiler, { | ||
publicPath: clientConfig.output.publicPath, | ||
stats: { | ||
colors: true, | ||
chunks: false | ||
} | ||
})) | ||
app.use(require('webpack-hot-middleware')(clientCompiler)) | ||
|
||
const serverCompiler = webpack(serverConfig) | ||
const mfs = new MFS() | ||
const outputPath = path.join(serverConfig.output.path, serverConfig.output.filename) | ||
serverCompiler.outputFileSystem = mfs | ||
serverCompiler.watch({}, (err, stats) => { | ||
if (err) throw err | ||
stats = stats.toJson() | ||
stats.errors.forEach(err => console.error(err)) | ||
stats.warnings.forEach(err => console.warn(err)) | ||
onUpdate(mfs.readFileSync(outputPath, 'utf-8')) | ||
}) | ||
} |
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 |
---|---|---|
@@ -0,0 +1,7 @@ | ||
module.exports = { | ||
postcss: [ | ||
require('autoprefixer')({ | ||
browsers: ['last 3 versions'] | ||
}) | ||
] | ||
} |
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 |
---|---|---|
@@ -0,0 +1,38 @@ | ||
const path = require('path') | ||
const webpack = require('webpack') | ||
const vueConfig = require('./vue-loader.config') | ||
|
||
module.exports = { | ||
devtool: '#source-map', | ||
entry: { | ||
app: './src/client-entry.js', | ||
vendor: ['vue', 'vue-router', 'lru-cache', 'es6-promise'] | ||
}, | ||
output: { | ||
path: path.resolve(__dirname, '../dist'), | ||
publicPath: '/dist/', | ||
filename: 'client-bundle.js' | ||
}, | ||
module: { | ||
rules: [ | ||
{ | ||
test: /\.vue$/, | ||
loader: 'vue', | ||
options: vueConfig | ||
}, | ||
{ | ||
test: /\.js$/, | ||
loader: 'babel', | ||
exclude: /node_modules/ | ||
}, | ||
{ | ||
test: /\.(png|jpg|gif|svg)$/, | ||
loader: 'url', | ||
options: { | ||
limit: 10000, | ||
name: '[name].[ext]?[hash]' | ||
} | ||
} | ||
] | ||
} | ||
} |
Oops, something went wrong.
127d723
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
似乎整个项目就变为只支持ssr的了,有没有能同时支持编译普通的vue项目和ssr的方案