A wrapper loader of weex-loader for .js file
requires weex-loader installed
npm i weexjs-loader
If you want to use weex-loader but do not want to make .vue or .we file and want to separate html,css,js files.
Use the loader either via your webpack config or inline.
webpack.config.js
const path = require('path')
module.exports = {
module: {
rules: [
{
test: /\.js$/,
include: path.resolve(__dirname, 'YOUR APP PATH'),
loader: 'weexjs-loader'
},
],
}
}
In your application
import component from './app.js'
In your application
import component from 'weexjs-loader!./app.js'
DIR
app/
- app.js
- app.html
- app.css
assets/
- ...
app.js
export default {
name: 'app',
templateSrc: './app.html',
styleSrc: './app.css',
}
import component from 'weexjs-loader!./app.js'
imported component object equals below
app.we
<script>
export default {
name: 'app',
templateSrc: './app.html',
styleSrc: './app.css',
}
</script>
<template src="./app.html"></template>
<style scoped src="./app.css"></template>
import component from 'weex-loader!./app.we'
The MIT License (MIT)
Copyright (c) 2017 Elevista