Comments (10)
I found a solution to this problem. To properly load vue-tables-2, the jsx template files need to be compiled with Babel. It won't compile when you exclude node_modules in the jsx loader. I use this:
loaders: [
{
test: /\.jsx$/,
loader: 'babel'
},
{
test: /\.js$/,
loader: 'babel',
exclude: /node_modules/
},
]
You may also need to compile the javascript in the node_modules/vue-tables-2
and node_modules/vue-pagination-2
folders. This config worked for me in the end. It will compile .js and .jsx, and ignore everything in node_modules except for the two folders:
loaders: [
{
test: /\.jsx?$/,
loader: 'babel',
exclude: /node_modules(?!\/(vue-tables-2|vue-pagination-2))/
},
]
from babel-plugin-transform-vue-jsx.
Small precision, I added this line to the webpack configuration:
{ test: /\.jsx?$/, loader: 'babel' }
from babel-plugin-transform-vue-jsx.
{ test: /\.jsx$/, loader: 'babel', }, { test: /vue-tables-2.*?js$/, loader: 'babel' },
from babel-plugin-transform-vue-jsx.
the same problem, fix with solution from @eirabben
module.exports = {
module: {
loaders: [
{
test: /\.jsx$/,
loader: 'babel'
},
{
test: /\.js$/,
loader: 'babel',
exclude: /node_modules/
},
]
}
}
from babel-plugin-transform-vue-jsx.
I am having the same problem with jsx templates. my config below:
package.json:
"dependencies": {
"vue": "^2.0.1",
"vue-resource": "^1.0.3",
"vue-pagination-2": "^0.1.91",
"vue-tables-2": "0.0.8"
},
"devDependencies": {
"babel-core": "^6.0.0",
"babel-helper-vue-jsx-merge-props": "^2.0.1",
"babel-loader": "^6.0.0",
"babel-plugin-syntax-jsx": "^6.13.0",
"babel-plugin-transform-vue-jsx": "^3.1.0",
"babel-preset-es2015": "^6.0.0",
"cross-env": "^3.0.0",
"css-loader": "^0.25.0",
"file-loader": "^0.9.0",
"vue-loader": "^9.5.1",
"webpack": "^1.13.2",
"webpack-dev-server": "^1.16.1"
}
.babelrc
{
"presets": ["es2015", "stage-2"],
"plugins": ["transform-vue-jsx"]
}
and this is the webpack.config.js
module.exports = {
entry: './src/main.js',
output: {
path: path.resolve(__dirname, './dist'),
publicPath: '/dist/',
filename: 'build.js'
},
resolveLoader: {
root: path.join(__dirname, 'node_modules'),
},
module: {
loaders: [
{
test: /\.vue$/,
loader: 'vue'
},
{
test: /\.jsx$/,
loader: 'babel-loader',
exclude: /node_modules/
},
{
test: /\.js$/,
loader: 'babel',
exclude: /node_modules/
},
{
test: /\.(png|jpg|gif|svg)$/,
loader: 'file',
query: {
name: '[name].[ext]?[hash]'
}
}
]
},
devServer: {
historyApiFallback: true,
noInfo: true
},
devtool: '#eval-source-map'
}```
from babel-plugin-transform-vue-jsx.
Unfortunately I have the same issue, but with babelify.
I've opened a bug report on vue-tables-2 matfish2/vue-tables-2#69 .
I even tried specifying extensions: [".js", ".json", ".jsx"], in both brwoserify and babelify
from babel-plugin-transform-vue-jsx.
Closing for inactivity. Please reopen a new issue if you have the same problem.
from babel-plugin-transform-vue-jsx.
same problem
var path = require('path');
var config = {
entry: [
'webpack/hot/dev-server',
'webpack-dev-server/client?http://localhost:8080',
path.resolve(__dirname, 'app/main.js')
],
output: {
path: path.resolve(__dirname, 'build'),
filename: 'bundle.js'
},
module: {
loaders: [{
test: /\.jsx?$/,
loader: 'babel-loader',
exclude: /node_modules/
}]
}
};
module.exports = config;
from babel-plugin-transform-vue-jsx.
@lihel, can you provide minimal reproduction in a github repository please?
from babel-plugin-transform-vue-jsx.
Closing for inactivity.
from babel-plugin-transform-vue-jsx.
Related Issues (20)
- how to pass a prop named "model" to the custom component like el-form
- `h` is not auto-injected with Laravel-Mix and Vue using @vue/babel-plugin-transform-vue-jsx v1.0.0-beta.3 HOT 1
- sass content in .vue file not compiled HOT 1
- Concrete preset instead on env HOT 1
- Vuetify modifiers behave differently
- Vue 3 and TSX HOT 6
- rollup+babel+babel-plugin-transform-vue-jsx package size so big
- delete this
- delete this
- delete this
- delete this
- JSX fragment syntax (<> ... </>) HOT 4
- How to add JSX Support to Existing MVC .NET Application
- How to add 'comments' in vue jsx HOT 2
- JSX compilation fails when nested under another node_modules directory
- Support for xmlns:xlink attribute
- how to write the arguments of the custom directives? HOT 2
- String turn into jsx code HOT 1
- [Question] How to use emits in component ?
- Convert JSX to string in template
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from babel-plugin-transform-vue-jsx.