-
Notifications
You must be signed in to change notification settings - Fork 12
/
Copy pathwebpack.config.js
60 lines (57 loc) · 1.64 KB
/
webpack.config.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
var webpack = require('webpack')
var prism = require('prismjs')
var autoprefixer = require('autoprefixer')
var BrowserSyncPlugin = require('browser-sync-webpack-plugin')
var marked = require('marked')
var renderer = new marked.Renderer()
renderer.code = (code, language) => {
var html = prism.highlight(code, prism.languages.javascript)
return `<pre class="language-${language}"><code class="language-${language}">${html}</code></pre>`
}
module.exports = {
entry: './index.js',
output: {
path: './',
filename: 'bundle.js',
sourceMapFilename: "[name].js.map",
},
module: {
preLoaders: [
{ test: /\.html$/, loader: 'riotjs' },
{ test: /\.js$/, loader: 'eslint!source-map' },
],
loaders: [
{ test: /\.md$/, loader: 'html!markdown'},
{ test: /\.(jpe?g|png|gif|svg|mp4)$/i, loader: 'file'},
{ test: /\.html$|\.js$/, loader: 'babel', query: { presets: 'es2015-riot' }},
{ test: /\.less$/, loader: 'style!css?minimize!postcss!less'},
]
},
markdownLoader: {
renderer: renderer
},
postcss: () => {
return [
autoprefixer({browsers: 'last 2 versions'})
];
},
plugins: [
new webpack.ProvidePlugin({
riot: 'riot'
}),
new BrowserSyncPlugin(
{
host: 'localhost',
port: 8081,
proxy: 'http://localhost:8080/'
},
{
reload: true
}
)
],
eslint: {
configFile: './.eslintrc'
},
devtool: 'source-map'
}