[Pkg-javascript-devel] trying to build libjs-vue
Paolo Greppi
paolo.greppi at libpf.com
Fri Dec 1 11:41:07 UTC 2017
Il 01/12/2017 06:55, Pirate Praveen ha scritto:
> On വെള്ളി 01 ഡിസംബര് 2017 12:05 രാവിലെ, Paolo Greppi wrote:
>> According to this:
>> https://medium.com/webpack/webpack-and-rollup-the-same-but-different-a41ad427058c
>> we really should use rollup over webpack.
>
> But we don't have rollup in main, we have been working on it for quite
> some time and it is going to take quite some more time before we can use
> it in main. webpack is almost there (packaging complete), except for the
> conflict with ftp masters on node-babel-preset-env.
>
> See node-d3-zoom or node-d3-scale for example webpack configuration.
Good tip Praveen: webpack succeded in compiling vue.js !
I install node-babel-preset-env from local build, then:
apt install webpack node-babel-loader node-babel-plugin-add-module-exports
cat .babelrc
{
"presets": [
"es2015",
"flow-vue"],
"plugins": [
"syntax-dynamic-import",
"babel-plugin-add-module-exports",
],
"ignore": [
"dist/*.js",
"packages/**/*.js"
]
}
cat webpack.config.js
'use strict';
var fs = require('fs');
var path = require('path');
var webpack = require('webpack');
var config = {
target: 'web',
entry: './src/platforms/web/entry-runtime-with-compiler.js',
resolve: {
modules: ['/usr/lib/nodejs', './src', './src/platforms'],
},
resolveLoader: {
modules: ['/usr/lib/nodejs'],
},
output: {
path: path.resolve(__dirname, 'dist'),
filename: 'vue.js',
library: "Vue",
libraryTarget: 'umd',
umdNamedDefine: true
},
module: { rules: [ { use: [ 'babel-loader' ] } ] }
}
module.exports = config;
webpack --config webpack.config.js
I get frequent segmentation faults, probably the same as https://bugs.debian.org/878674
BTW, I can get rid of those with:
npm install webpack
(I then keep using the binary installed by the package, but the locally installed node
modules somehow cure the problem; I should probably report that to #878674 ...)
Anyway when ends I get a much larger "binary":
-rw-r--r-- 1 root root 468242 Dec 1 12:35 vue.js
and when I test that in a test application it works !
This is twice the size of the "binary" produced by upstream with rollup, but I still have
to experiment with dead code removal (https://webpack.js.org/guides/tree-shaking/#minify-the-output).
In any case we have to wait for node-babel-preset-env before I proceed with the RFS of this one.
Paolo
More information about the Pkg-javascript-devel
mailing list