UPDATE: vue-tables-2 is now served pre-compiled, so no loaders are needed. For the templates
option it is recommended to use scoped slots, which also don't require any special settings
I'm using gulp, webpack, and the babel-loader to build some files (vue-tables-2):
gulp.task('scripts-vue-tables', function() {
gulp.src('node_modules/vue-tables-2/index.js')
.pipe(webpackstream({
output: {
path: __dirname,
filename: "vue-tables-2.js",
library: 'VueTables2',
libraryTarget: 'var'
}
}
))
.pipe(gulp.dest('public/vendor/vue-tables-2/js/'));
}
In webpack.config.js
I have included:
loaders: [
{
test: /\.jsx?$/,
loader: 'babel-loader',
query: {
presets: ["latest", "react", "stage-0"],
plugins: ["transform-vue-jsx"]
}
},
]
And included the same in .babelrc
:
{
"presets": ["latest", "react", "stage-0"],
"plugins": ["transform-vue-jsx"]
}
But, running the scripts-vue-tables
task yields the error:
Module parse failed: \node_modules\vue-tables-2\lib\template.jsx Unexpected token (15:7)
You may need an appropriate loader to handle this file type.
Note: In general, I have tried to follow the steps outlined here.
webpack.config.js
is the file read if you use the webpack CLI interface, but in your Gulp example usecase, it will not be used. You'd probably want something like
.pipe(webpackstream(Object.assign({
output: {
path: __dirname,
filename: "vue-tables-2.js",
library: 'VueTables2',
libraryTarget: 'var'
},
}, require('./webpack.config')))
to load both the Webpack configuration and the special output
logic.