mirror of
https://github.com/a-nyx/maputnik-with-pmtiles.git
synced 2024-12-28 15:11:16 +01:00
Fix build process for mapbox gl
This commit is contained in:
parent
0e65ac8937
commit
e4049fa5da
8 changed files with 49 additions and 31 deletions
|
@ -91,6 +91,6 @@
|
||||||
"webpack": "1.13.2",
|
"webpack": "1.13.2",
|
||||||
"webpack-cleanup-plugin": "^0.3.0",
|
"webpack-cleanup-plugin": "^0.3.0",
|
||||||
"webpack-dev-server": "1.15.1",
|
"webpack-dev-server": "1.15.1",
|
||||||
"webworkify-webpack": "^1.1.7"
|
"webworkify-webpack": "^1.1.3"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,7 +9,6 @@ import { StyleStore } from './stylestore.js'
|
||||||
import { WorkspaceDrawer } from './workspace.jsx'
|
import { WorkspaceDrawer } from './workspace.jsx'
|
||||||
|
|
||||||
import theme from './theme.js'
|
import theme from './theme.js'
|
||||||
import layout from './layout.scss'
|
|
||||||
|
|
||||||
export default class App extends React.Component {
|
export default class App extends React.Component {
|
||||||
static childContextTypes = {
|
static childContextTypes = {
|
||||||
|
@ -78,9 +77,7 @@ export default class App extends React.Component {
|
||||||
workContext={this.state.workContext}
|
workContext={this.state.workContext}
|
||||||
mapStyle={this.state.currentStyle}
|
mapStyle={this.state.currentStyle}
|
||||||
/>
|
/>
|
||||||
<div className={layout.map}>
|
|
||||||
<Map mapStyle={this.state.currentStyle} />
|
<Map mapStyle={this.state.currentStyle} />
|
||||||
</div>
|
</div>
|
||||||
</div>
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,12 +1,8 @@
|
||||||
@mixin full-height {
|
.map {
|
||||||
position: fixed;
|
position: fixed;
|
||||||
top: 0;
|
top: 0;
|
||||||
bottom: 0;
|
bottom: 0;
|
||||||
height: 100%;
|
height: 100%;
|
||||||
}
|
|
||||||
|
|
||||||
.map {
|
|
||||||
@include full-height;
|
|
||||||
width: 100%;
|
width: 100%;
|
||||||
|
|
||||||
& > div {
|
& > div {
|
||||||
|
|
11
src/map.jsx
11
src/map.jsx
|
@ -1,7 +1,7 @@
|
||||||
import React from 'react'
|
import React from 'react'
|
||||||
import MapboxGl from 'mapbox-gl';
|
import MapboxGl from 'mapbox-gl';
|
||||||
import diffStyles from 'mapbox-gl-style-spec/lib/diff'
|
//import diffStyles from 'mapbox-gl-style-spec/lib/diff'
|
||||||
import theme from './theme.js'
|
import { fullHeight } from './theme.js'
|
||||||
import Immutable from 'immutable'
|
import Immutable from 'immutable'
|
||||||
|
|
||||||
export class Map extends React.Component {
|
export class Map extends React.Component {
|
||||||
|
@ -50,6 +50,11 @@ export class Map extends React.Component {
|
||||||
}
|
}
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
return <div ref={x => this.container = x}></div>
|
return <div style={{
|
||||||
|
...fullHeight,
|
||||||
|
width: "100%",
|
||||||
|
}}>
|
||||||
|
<div ref={x => this.container = x}></div>
|
||||||
|
</div>
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,6 +3,13 @@ const caps = {
|
||||||
letterSpacing: '.2em'
|
letterSpacing: '.2em'
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export const fullHeight = {
|
||||||
|
position: "fixed",
|
||||||
|
top: 0,
|
||||||
|
bottom: 0,
|
||||||
|
height: "100%",
|
||||||
|
}
|
||||||
|
|
||||||
const baseColors = {
|
const baseColors = {
|
||||||
black: '#242424',
|
black: '#242424',
|
||||||
gray: '#313131',
|
gray: '#313131',
|
||||||
|
|
|
@ -24,19 +24,6 @@ loaders.push({
|
||||||
'sass'
|
'sass'
|
||||||
]
|
]
|
||||||
});
|
});
|
||||||
|
|
||||||
// Mapbox GL
|
|
||||||
loaders.push({
|
|
||||||
test: /\.json$/,
|
|
||||||
loader: 'json-loader'
|
|
||||||
});
|
|
||||||
|
|
||||||
loaders.push({
|
|
||||||
test: /\.js$/,
|
|
||||||
include: path.resolve('node_modules/mapbox-gl-shaders/index.js'),
|
|
||||||
loader: 'transform/cacheable?brfs'
|
|
||||||
});
|
|
||||||
|
|
||||||
// local css modules
|
// local css modules
|
||||||
loaders.push({
|
loaders.push({
|
||||||
test: /[\/\\]src[\/\\].*\.css/,
|
test: /[\/\\]src[\/\\].*\.css/,
|
||||||
|
@ -61,7 +48,7 @@ module.exports = {
|
||||||
alias: {
|
alias: {
|
||||||
'webworkify': 'webworkify-webpack',
|
'webworkify': 'webworkify-webpack',
|
||||||
// TODO: otherwise I get a max call stack error in browser?
|
// TODO: otherwise I get a max call stack error in browser?
|
||||||
'mapbox-gl': path.resolve('./node_modules/mapbox-gl/dist/mapbox-gl.js')
|
// 'mapbox-gl': path.resolve('./node_modules/mapbox-gl/dist/mapbox-gl.js')
|
||||||
},
|
},
|
||||||
extensions: ['', '.js', '.jsx']
|
extensions: ['', '.js', '.jsx']
|
||||||
},
|
},
|
||||||
|
@ -73,6 +60,9 @@ module.exports = {
|
||||||
query: 'brfs'
|
query: 'brfs'
|
||||||
}]
|
}]
|
||||||
},
|
},
|
||||||
|
node: {
|
||||||
|
fs: "empty"
|
||||||
|
},
|
||||||
devServer: {
|
devServer: {
|
||||||
contentBase: "./public",
|
contentBase: "./public",
|
||||||
// do not print bundle build stats
|
// do not print bundle build stats
|
||||||
|
|
|
@ -47,5 +47,14 @@ module.exports = [
|
||||||
test: /\.png/,
|
test: /\.png/,
|
||||||
exclude: /(node_modules|bower_components)/,
|
exclude: /(node_modules|bower_components)/,
|
||||||
loader: "url-loader?limit=10000&mimetype=image/png"
|
loader: "url-loader?limit=10000&mimetype=image/png"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
test: /\.json$/,
|
||||||
|
loader: 'json-loader'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
test: /\.js$/,
|
||||||
|
include: '/node_modules/mapbox-gl-shaders/index.js',
|
||||||
|
loader: 'transform/cacheable?brfs'
|
||||||
}
|
}
|
||||||
];
|
];
|
||||||
|
|
|
@ -32,11 +32,25 @@ module.exports = {
|
||||||
filename: '[chunkhash].js'
|
filename: '[chunkhash].js'
|
||||||
},
|
},
|
||||||
resolve: {
|
resolve: {
|
||||||
|
alias: {
|
||||||
|
'webworkify': 'webworkify-webpack',
|
||||||
|
},
|
||||||
extensions: ['', '.js', '.jsx']
|
extensions: ['', '.js', '.jsx']
|
||||||
},
|
},
|
||||||
module: {
|
module: {
|
||||||
loaders
|
loaders
|
||||||
},
|
},
|
||||||
|
module: {
|
||||||
|
loaders,
|
||||||
|
postLoaders: [{
|
||||||
|
include: /node_modules\/mapbox-gl-shaders/,
|
||||||
|
loader: 'transform',
|
||||||
|
query: 'brfs'
|
||||||
|
}]
|
||||||
|
},
|
||||||
|
node: {
|
||||||
|
fs: "empty"
|
||||||
|
},
|
||||||
plugins: [
|
plugins: [
|
||||||
new WebpackCleanupPlugin(),
|
new WebpackCleanupPlugin(),
|
||||||
new webpack.DefinePlugin({
|
new webpack.DefinePlugin({
|
||||||
|
|
Loading…
Reference in a new issue