Update for ol@5

This commit is contained in:
Tim Schaub 2018-06-26 16:01:18 -06:00
parent 3e5641a20a
commit 2939d90df1
4 changed files with 9 additions and 24 deletions

View file

@ -3,6 +3,7 @@
<head> <head>
<meta charset="utf-8"> <meta charset="utf-8">
<title>Using OpenLayers with Webpack</title> <title>Using OpenLayers with Webpack</title>
<link rel="stylesheet" href="https://openlayers.org/en/latest/css/ol.css" type="text/css">
<style> <style>
html, body { html, body {
margin: 0; margin: 0;

View file

@ -1,8 +1,6 @@
import 'ol/ol.css'; import {Map, View} from 'ol';
import Map from 'ol/map'; import TileLayer from 'ol/layer/Tile';
import View from 'ol/view'; import XYZ from 'ol/source/XYZ';
import TileLayer from 'ol/layer/tile';
import XYZ from 'ol/source/xyz';
new Map({ new Map({
target: 'map', target: 'map',

View file

@ -3,14 +3,13 @@
"version": "1.0.0", "version": "1.0.0",
"description": "Example using OpenLayers with Webpack", "description": "Example using OpenLayers with Webpack",
"scripts": { "scripts": {
"build": "webpack --config webpack.config.js" "build": "webpack --config webpack.config.js --mode production"
}, },
"devDependencies": { "devDependencies": {
"css-loader": "^0.28.4", "webpack": "^4.12.1",
"style-loader": "^0.18.2", "webpack-command": "^0.3.0"
"webpack": "^3.3.0"
}, },
"dependencies": { "dependencies": {
"ol": "^4.2.0" "ol": "^5.0.0"
} }
} }

View file

@ -3,20 +3,7 @@ const webpack = require('webpack');
module.exports = { module.exports = {
entry: './main.js', entry: './main.js',
output: { output: {
path: __dirname,
filename: 'bundle.js' filename: 'bundle.js'
}, },
module: {
rules: [
{
test: /\.css$/,
use: [
{loader: 'style-loader'},
{loader: 'css-loader'}
]
}
]
},
plugins: [
new webpack.optimize.UglifyJsPlugin()
]
}; };