add files to be able to work with play.js
This commit is contained in:
parent
3c4670a728
commit
6e13e194cc
|
@ -0,0 +1,33 @@
|
||||||
|
const express = require('express');
|
||||||
|
const webpack = require('webpack');
|
||||||
|
const webpackMiddleware = require('webpack-dev-middleware');
|
||||||
|
|
||||||
|
// Setup
|
||||||
|
const app = express();
|
||||||
|
const port = process.env['WEB_APP_PORT'];
|
||||||
|
const config = require('./webpack.config.dev.js');
|
||||||
|
const compiler = webpack(config);
|
||||||
|
const middleware = webpackMiddleware(compiler, {
|
||||||
|
publicPath: "/",
|
||||||
|
serverSideRender: true,
|
||||||
|
watchOptions: {
|
||||||
|
// Due to iOS devices memory constraints
|
||||||
|
// disabling file watching is recommended
|
||||||
|
ignored: /.*/
|
||||||
|
}
|
||||||
|
});
|
||||||
|
app.use(middleware);
|
||||||
|
app.get('/', (req, res) => {
|
||||||
|
res.sendFile('public/index.html', { root: __dirname });
|
||||||
|
});
|
||||||
|
|
||||||
|
// Launch app
|
||||||
|
app.listen(port, () => {
|
||||||
|
console.log(
|
||||||
|
'Launching app... http://localhost:' + port + '\n'
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
|
// Register app and middleware. Required for better
|
||||||
|
// performance when running from play.js
|
||||||
|
try { pjs.register(app, middleware); } catch (error) { }
|
|
@ -0,0 +1,44 @@
|
||||||
|
'use strict'
|
||||||
|
const { VueLoaderPlugin } = require('vue-loader');
|
||||||
|
module.exports = {
|
||||||
|
mode: 'development',
|
||||||
|
entry: [
|
||||||
|
'./src/main.js'
|
||||||
|
],
|
||||||
|
module: {
|
||||||
|
rules: [
|
||||||
|
{
|
||||||
|
test: /\.vue$/,
|
||||||
|
use: {
|
||||||
|
loader: 'vue-loader',
|
||||||
|
options: {
|
||||||
|
presets: [
|
||||||
|
'@babel/preset-env'
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
test: /\.css$/,
|
||||||
|
use: [
|
||||||
|
'vue-style-loader',
|
||||||
|
'css-loader'
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
test: /\.(png|jpe?g|gif)$/i,
|
||||||
|
use: [
|
||||||
|
{
|
||||||
|
loader: 'file-loader',
|
||||||
|
},
|
||||||
|
]
|
||||||
|
},
|
||||||
|
]
|
||||||
|
},
|
||||||
|
plugins: [
|
||||||
|
new VueLoaderPlugin()
|
||||||
|
],
|
||||||
|
resolve: {
|
||||||
|
extensions: ['.js', '.vue'],
|
||||||
|
}
|
||||||
|
}
|
Reference in New Issue