first commit
This commit is contained in:
72
webpack.config.js
Normal file
72
webpack.config.js
Normal file
@@ -0,0 +1,72 @@
|
||||
const path = require('path');
|
||||
const HtmlWebpackPlugin = require('html-webpack-plugin');
|
||||
const MiniCssExtractPlugin = require('mini-css-extract-plugin');
|
||||
const request = require("request");
|
||||
|
||||
module.exports = {
|
||||
entry: {
|
||||
AVideo: './src/App.ts'
|
||||
},
|
||||
output: {
|
||||
path: path.resolve(__dirname, 'dist'),
|
||||
filename: '[name].min.js'
|
||||
},
|
||||
devServer: {
|
||||
contentBase: path.join(__dirname, 'dist'),
|
||||
compress: true,
|
||||
port: 9000,
|
||||
allowedHosts: [
|
||||
'txmov2.a.yximgs.com'
|
||||
],
|
||||
before(app) {
|
||||
app.all('*', function (req, res, next) {
|
||||
res.header('Access-Control-Allow-Origin', '*');
|
||||
res.header('Access-Control-Allow-Headers', 'Content-Type');
|
||||
res.header('Access-Control-Allow-Methods', '*');
|
||||
next();
|
||||
});
|
||||
|
||||
app.get('/check/url', async function(req, res) {
|
||||
const options = { url: req.query.url, headers: { range: 'bytes=0-50' } };
|
||||
request(options, async (error, response, body) => {
|
||||
await res.json({ result: response.headers['content-type'] });
|
||||
});
|
||||
});
|
||||
}
|
||||
},
|
||||
resolve: {
|
||||
extensions: ['.ts', '.js', '.json']
|
||||
},
|
||||
module: {
|
||||
rules: [
|
||||
{
|
||||
test: /\.tsx?$/,
|
||||
use: { loader: 'ts-loader' }
|
||||
},
|
||||
{
|
||||
test: /\.less$/,
|
||||
use: [
|
||||
{
|
||||
loader: MiniCssExtractPlugin.loader,
|
||||
options: {
|
||||
publicPaht: '../'
|
||||
}
|
||||
},
|
||||
'css-loader', 'less-loader'
|
||||
]
|
||||
},
|
||||
{
|
||||
test: /\.pug$/,
|
||||
use: ["pug-loader"]
|
||||
},
|
||||
]
|
||||
},
|
||||
plugins: [
|
||||
new HtmlWebpackPlugin({
|
||||
template: path.join(__dirname, './src/index.pug')
|
||||
}),
|
||||
new MiniCssExtractPlugin({
|
||||
filename: '[name].min.css'
|
||||
})
|
||||
]
|
||||
};
|
||||
Reference in New Issue
Block a user