-
Notifications
You must be signed in to change notification settings - Fork 0
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
caoli
committed
Sep 12, 2017
1 parent
2fcb195
commit 0d9b277
Showing
10 changed files
with
97 additions
and
113 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,9 @@ | ||
'use strict'; | ||
module.exports = { | ||
cssExtract: false, | ||
options: { | ||
resolve: { | ||
extensions: ['.vue'] | ||
} | ||
} | ||
}; |
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,41 @@ | ||
'use strict'; | ||
exports.weex = { | ||
test: /\.vue$/, | ||
type: 'weex', | ||
exclude: /node_modules/, | ||
use() { | ||
return [ | ||
{ | ||
loader: 'weex-loader', | ||
options: this.createFrameworkLoader('weex-vue-loader/lib/style-loader') | ||
} | ||
]; | ||
} | ||
}; | ||
|
||
exports.vue = { | ||
test: /\.vue$/, | ||
type: 'web', | ||
exclude: /node_modules/, | ||
use() { | ||
return [ | ||
{ | ||
loader: 'vue-loader', | ||
options: this.merge(this.createFrameworkLoader('vue-style-loader'), { | ||
compilerModules: [{ | ||
postTransformNode: el => { | ||
el.staticStyle = `$processStyle(${el.staticStyle})`; | ||
el.styleBinding = `$processStyle(${el.styleBinding})`; | ||
} | ||
}] | ||
}) | ||
} | ||
]; | ||
} | ||
}; | ||
|
||
exports.vuehtml = { | ||
test: /\.html$/, | ||
type: 'web', | ||
use: ['vue-html-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,30 @@ | ||
'use strict'; | ||
const EasyWebpack = require('easywebpack'); | ||
|
||
exports.banner = { | ||
enable: true, | ||
type: 'weex', | ||
name: EasyWebpack.webpack.BannerPlugin, | ||
args: { banner: '// { "framework": "Vue" }\n', raw: true } | ||
}; | ||
|
||
exports.commonsChunk = { | ||
type: 'web' | ||
}; | ||
|
||
|
||
exports.hot = { | ||
type: 'web' | ||
}; | ||
|
||
exports.imagemini = { | ||
type: ['web', 'weex'] | ||
}; | ||
|
||
exports.html = { | ||
type: 'web' | ||
}; | ||
|
||
exports.buildfile = false; | ||
|
||
exports.manifest = false; |
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,29 +1,10 @@ | ||
'use strict'; | ||
const EasyWebpack = require('easywebpack'); | ||
const merge = EasyWebpack.merge; | ||
const defaultConfig = require('./config'); | ||
const WebpackBaseBuilder = WebpackBuilder => class extends WebpackBuilder { | ||
constructor(config) { | ||
super(merge(config, defaultConfig)); | ||
this.setExtractCss(false); | ||
this.setExtensions('.vue'); | ||
this.setOption({ | ||
resolveLoader: { | ||
alias: { | ||
'scss-loader': 'sass-loader' | ||
} | ||
} | ||
}); | ||
const styles = ['css', 'sass', 'less', 'scss']; | ||
const styleLoaderOption = {}; | ||
styles.forEach(style => { | ||
styleLoaderOption[style] = { | ||
deps: { | ||
postcss: false | ||
} | ||
}; | ||
}); | ||
this.setStyleLoaderOption(styleLoaderOption); | ||
super(config); | ||
this.mergeConfig(require('../config/config')); | ||
this.mergeLoader(require('../config/loader')); | ||
this.mergePlugin(require('../config/plugin')); | ||
} | ||
}; | ||
module.exports = WebpackBaseBuilder; |
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,57 +1,12 @@ | ||
'use strict'; | ||
const EasyWebpack = require('easywebpack'); | ||
const webpack = EasyWebpack.webpack; | ||
const Loader = EasyWebpack.Loader; | ||
const WebpackBaseBuilder = require('./base'); | ||
|
||
class WebpackWeexWebBuilder extends WebpackBaseBuilder(EasyWebpack.WebpackClientBuilder) { | ||
constructor(config) { | ||
super(config); | ||
this.type = 'web'; | ||
if (this.config.html === undefined) { | ||
this.config.html = true; | ||
} | ||
this.setPrefix('web'); | ||
this.setCommonsChunk('vendor'); | ||
this.addLoader(/\.html$/, 'vue-html-loader'); | ||
this.addLoader({ | ||
test: /\.vue$/, | ||
fn: () => this.createWeexVueLoader() | ||
}); | ||
this.addPlugin(new webpack.DefinePlugin({ | ||
'process.env': { | ||
PLATFORM: '"web"' | ||
} | ||
})); | ||
} | ||
|
||
createVueStyleLoader() { | ||
return Loader.getLoaderConfig('vue-style-loader', this.getStyleConfig()); | ||
} | ||
|
||
createWeexVueLoader() { | ||
const styleConfig = this.getStyleConfig(); | ||
const vueStyleLoader = this.createVueStyleLoader(); | ||
const cssLoader = Loader.getCssLoader(styleConfig); | ||
const sassLoader = Loader.getSassLoader(styleConfig); | ||
return { | ||
use: { | ||
loader: 'vue-loader', | ||
options: { | ||
loaders: { | ||
css: [vueStyleLoader, cssLoader], | ||
scss: [vueStyleLoader, cssLoader, sassLoader], | ||
sass: [vueStyleLoader, cssLoader, sassLoader] | ||
}, | ||
compilerModules: [{ | ||
postTransformNode: el => { | ||
el.staticStyle = `$processStyle(${el.staticStyle})`; | ||
el.styleBinding = `$processStyle(${el.styleBinding})`; | ||
} | ||
}] | ||
} | ||
} | ||
}; | ||
this.setAlias('vue', 'vue/dist/vue.common.js', false); | ||
} | ||
} | ||
module.exports = WebpackWeexWebBuilder; |
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,43 +1,13 @@ | ||
'use strict'; | ||
const EasyWebpack = require('easywebpack'); | ||
const Loader = EasyWebpack.Loader; | ||
const webpack = EasyWebpack.webpack; | ||
const WebpackBaseBuilder = require('./base'); | ||
|
||
class WebpackWeexBuilder extends WebpackBaseBuilder(EasyWebpack.WebpackClientBuilder) { | ||
constructor(config) { | ||
super(config); | ||
this.type = 'weex' | ||
this.setHot(false); | ||
this.type = 'weex'; | ||
this.setPrefix('weex'); | ||
this.setHtml(false); | ||
this.setExternals(['vue']); | ||
this.addLoader(/\.vue$/, 'weex-loader', () => this.createWeexLoader()); | ||
this.addPlugin(webpack.BannerPlugin, { banner: '// { "framework": "Vue" }\n', raw: true }); | ||
this.addPlugin(webpack.DefinePlugin, { | ||
'process.env': { | ||
PLATFORM: '"weex"' | ||
} | ||
}); | ||
} | ||
|
||
createWeexVueLoader() { | ||
return Loader.getLoaderConfig('weex-vue-loader/lib/style-loader', this.getStyleConfig()); | ||
} | ||
|
||
createWeexLoader() { | ||
const styleConfig = this.getStyleConfig(); | ||
const weexVueLoader = this.createWeexVueLoader(); | ||
const sassLoader = Loader.getSassLoader(styleConfig); | ||
return { | ||
options: { | ||
loaders: { | ||
css: [weexVueLoader], | ||
sass: [weexVueLoader, sassLoader], | ||
scss: [weexVueLoader, sassLoader] | ||
} | ||
} | ||
}; | ||
this.setConfig({ hash: false }); | ||
} | ||
} | ||
module.exports = WebpackWeexBuilder; |
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 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,4 @@ | ||
'use strict'; | ||
|
||
module.exports = {}; | ||
|
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