-
Notifications
You must be signed in to change notification settings - Fork 533
Even more modular #67
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Progress update: removing moment and lodash from bundle is working. Size drop from 1.2M to 308.4k for node_modules chunk. |
Nice! |
Could you show the webpack config? |
The only real change is here externals: {
"lodash": "lodash",
"moment": "moment"
}, Config so far var webpack = require("webpack");
var version = require("./package.json").version;
var banner = "/**\n" + " * vue-form-generator v" + version + "\n" + " * https://github.com/icebob/vue-form-generator\n" + " * Released under the MIT License.\n" + " */\n";
var ExtractTextPlugin = require("extract-text-webpack-plugin");
var StatsPlugin = require("stats-webpack-plugin");
var loaders = [
{
"test": /\.js?$/,
"exclude": /node_modules/,
"loader": "babel"
},
{
"test": /\.vue?$/,
"loader": "vue"
}
];
module.exports = [
{
entry: "./src/index",
output: {
path: "./dist",
filename: "vue-form-generator.js",
library: "VueFormGenerator",
libraryTarget: "umd"
},
externals: {
"lodash": "lodash",
"moment": "moment"
},
plugins: [
new webpack.DefinePlugin({
"process.env" : {
NODE_ENV : JSON.stringify("production")
}
}),
new webpack.optimize.UglifyJsPlugin({
compress: {
warnings: false
}
}),
new webpack.optimize.DedupePlugin(),
new webpack.BannerPlugin(banner, {
raw: true
}),
new ExtractTextPlugin("vue-form-generator.css", { allChunks: true }),
new StatsPlugin("../stats.json", {
chunkModules: true
//exclude: [/node_modules[\\\/]react/]
})
],
module: {
loaders: loaders
},
vue: {
loaders: {
css: ExtractTextPlugin.extract("css"),
postcss: ExtractTextPlugin.extract("css"),
sass: ExtractTextPlugin.extract("css!sass"),
}
},
resolve: {
packageAlias: "browser"
}
}
]; |
Closed
I closed it. More discussion in #112 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
A very modularized version of the app would be a plus.
My goal is:
The user only need to include the lib with a script tag and it work as expected (like today build).
This is close to Vue.js approach of the problem (
vue.js
vsvue.common.js
)The text was updated successfully, but these errors were encountered: