久久久久久久av_日韩在线中文_看一级毛片视频_日本精品二区_成人深夜福利视频_武道仙尊动漫在线观看

    • <bdo id='QMOCv'></bdo><ul id='QMOCv'></ul>

      <i id='QMOCv'><tr id='QMOCv'><dt id='QMOCv'><q id='QMOCv'><span id='QMOCv'><b id='QMOCv'><form id='QMOCv'><ins id='QMOCv'></ins><ul id='QMOCv'></ul><sub id='QMOCv'></sub></form><legend id='QMOCv'></legend><bdo id='QMOCv'><pre id='QMOCv'><center id='QMOCv'></center></pre></bdo></b><th id='QMOCv'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='QMOCv'><tfoot id='QMOCv'></tfoot><dl id='QMOCv'><fieldset id='QMOCv'></fieldset></dl></div>
    1. <tfoot id='QMOCv'></tfoot>

      <legend id='QMOCv'><style id='QMOCv'><dir id='QMOCv'><q id='QMOCv'></q></dir></style></legend>
    2. <small id='QMOCv'></small><noframes id='QMOCv'>

      1. webpack - 需要('node_modules/leaflet/leaflet.css')

        webpack - require(#39;node_modules/leaflet/leaflet.css#39;)(webpack - 需要(node_modules/leaflet/leaflet.css))

          <small id='Kt1Dx'></small><noframes id='Kt1Dx'>

          <i id='Kt1Dx'><tr id='Kt1Dx'><dt id='Kt1Dx'><q id='Kt1Dx'><span id='Kt1Dx'><b id='Kt1Dx'><form id='Kt1Dx'><ins id='Kt1Dx'></ins><ul id='Kt1Dx'></ul><sub id='Kt1Dx'></sub></form><legend id='Kt1Dx'></legend><bdo id='Kt1Dx'><pre id='Kt1Dx'><center id='Kt1Dx'></center></pre></bdo></b><th id='Kt1Dx'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='Kt1Dx'><tfoot id='Kt1Dx'></tfoot><dl id='Kt1Dx'><fieldset id='Kt1Dx'></fieldset></dl></div>
          <legend id='Kt1Dx'><style id='Kt1Dx'><dir id='Kt1Dx'><q id='Kt1Dx'></q></dir></style></legend>

            <tfoot id='Kt1Dx'></tfoot>
                <tbody id='Kt1Dx'></tbody>
                • <bdo id='Kt1Dx'></bdo><ul id='Kt1Dx'></ul>
                  本文介紹了webpack - 需要('node_modules/leaflet/leaflet.css')的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

                  問題描述

                  所以我正在嘗試使用 webpackleaflet 構建地圖應用程序.我可以從我的 map.js 文件中要求 leaflet.js,但我無法在不出錯的情況下調用 leaflet.css.

                  So I'm trying to build a map app using webpack and leaflet. I can require leaflet.js from my map.js file, but I can't call leaflet.css without getting an error.

                  我當前的 webpack.config.js 看起來像:

                  My current webpack.config.js looks like:

                  'use strict'
                  
                  var webpack = require('webpack'),
                      path = require('path'),
                      HtmlWebpackPlugin = require('html-webpack-plugin'),
                      srcPath = path.join(__dirname, 'src');
                  
                  module.exports = {
                      target: "web",
                      cache: true,
                      entry: {
                          app: path.join(srcPath, "index.js")
                      },
                      resolve: {
                          alais: {
                              leaflet_css: __dirname + "/node_modules/leaflet/dist/leaflet.css"
                          }
                      },
                      module: {
                          loaders: [
                            {test: /.js?$/, exclude: /node_modules/, loader: "babel-loader"},
                            {test: /.scss?$/, exclude: /node_modules/, loader: "style!css!sass!"},
                            {test: /.css?$/, loader: "style!css!"}
                          ]
                      },
                      plugins: [
                          new webpack.optimize.CommonsChunkPlugin("common", "common.js"),
                          new HtmlWebpackPlugin({
                            inject: true,
                            template: "src/index.html"
                          }),
                          new webpack.NoErrorsPlugin()
                        ],
                      output: {
                          path: path.join(__dirname, "dist"),
                          publicPath: "/dist/",
                          filename: "[name].js",
                          pathInfo: true
                      }
                  }
                  

                  我的 main.js 文件看起來像:

                  And my main.js file looks like:

                  var $ = require('jquery'),
                      leaflet = require('leaflet');
                  
                  require("./sass/main.scss");
                  require("leaflet_css");
                  
                  var map = L.map('map').setView([51.505, -0.09], 13);
                  
                  L.tileLayer('http://{s}.tile.osm.org/{z}/{x}/{y}.png', {
                      attribution: '&copy; <a >OpenStreetMap</a> contributors'
                  }).addTo(map);
                  
                  L.marker([51.5, -0.09]).addTo(map)
                      .bindPopup('A pretty CSS3 popup.<br> Easily customizable.')
                      .openPopup();
                  
                  console.log('I got called');
                  

                  通過 webpack 捆綁來自 3rd 方供應商的 css 文件的正確方法是什么?

                  What is the correct approach of bundling css files from 3rd party suppliers via webpack?

                  我看到 這個項目 是 leaflet 存放在 libs 目錄中...這是什么原因,如果通過 npm 安裝到 node_modules 目錄中,為什么要存放在 libs 目錄中?

                  I saw this project were leaflet is stored in the libs directory... what's the reason for this, why store it in the libs directory if it is installed into the node_modules direcory via npm?

                  這是一個非常重要的學習練習,因此非常感謝任何指針!:)

                  This is very much a learning exercise so any pointers are greatly appreciated! :)

                  推薦答案

                  原來如此,答案是webpack的resolve.alias和文件加載器的組合.我的新 webpack 文件如下所示:

                  So it turns out, the answer is a combination of webpack's resolve.alias and the file loader. My new webpack file looks like this:

                  'use strict'
                  
                  var webpack = require('webpack'),
                      path = require('path'),
                      HtmlWebpackPlugin = require('html-webpack-plugin'),
                      srcPath = path.join(__dirname, 'src');
                  
                  module.exports = {
                      target: "web",
                      cache: true,
                      entry: {
                          app: path.join(srcPath, "index.js")
                      },
                      resolve: {
                          extensions: ['', '.html', '.js', '.json', '.scss', '.css'],
                          alias: {
                              leaflet_css: __dirname + "/node_modules/leaflet/dist/leaflet.css",
                              leaflet_marker: __dirname + "/node_modules/leaflet/dist/images/marker-icon.png",
                              leaflet_marker_2x: __dirname + "/node_modules/leaflet/dist/images/marker-icon-2x.png",
                              leaflet_marker_shadow: __dirname + "/node_modules/leaflet/dist/images/marker-shadow.png"
                          }
                      },
                      module: {
                          loaders: [
                            {test: /.js?$/, exclude: /node_modules/, loader: "babel-loader"},
                            {test: /.scss?$/, exclude: /node_modules/, loader: "style-loader!css-loader!sass-loader!"},
                            {test: /.css?$/, loader: "style-loader!css-loader!"},
                            {test: /.(png|jpg)$/, loader: "file-loader?name=images/[name].[ext]"}
                          ]
                      },
                      plugins: [
                          new webpack.optimize.CommonsChunkPlugin("common", "common.js"),
                          new HtmlWebpackPlugin({
                            inject: true,
                            template: "src/index.html"
                          }),
                          new webpack.NoErrorsPlugin()
                        ],
                      output: {
                          path: path.join(__dirname, "dist"),
                          publicPath: "/dist/",
                          filename: "[name].js",
                          pathInfo: true
                      }
                  }
                  

                  然后我需要做的就是需要 .js 文件中的圖標

                  And then all I need to do is require the icons in the .js file

                  require("./sass/main");
                  require("leaflet_css");
                  require("leaflet_marker");
                  require("leaflet_marker_2x");
                  require("leaflet_marker_shadow");
                  

                  可愛!!!:)

                  這篇關于webpack - 需要('node_modules/leaflet/leaflet.css')的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!

                  【網站聲明】本站部分內容來源于互聯網,旨在幫助大家更快的解決問題,如果有圖片或者內容侵犯了您的權益,請聯系我們刪除處理,感謝您的支持!

                  相關文檔推薦

                  Changing leaflet markercluster icon color, inheriting the rest of the default CSS properties(更改傳單標記群集圖標顏色,繼承其余默認 CSS 屬性)
                  How can I change the default loading tile color in LeafletJS?(如何更改 LeafletJS 中的默認加載磁貼顏色?)
                  How do I show a label beyond a certain zoom level in Leaflet?(如何在 Leaflet 中顯示超出特定縮放級別的標簽?)
                  Assign ID to marker in leaflet(為傳單中的標記分配 ID)
                  react-leaflet map not correctly displayed(反應傳單地圖未正確顯示)
                  Npm postinstall only on development(Npm postinstall 僅用于開發)
                  • <bdo id='7JJWG'></bdo><ul id='7JJWG'></ul>

                      <tfoot id='7JJWG'></tfoot>

                        <small id='7JJWG'></small><noframes id='7JJWG'>

                          • <i id='7JJWG'><tr id='7JJWG'><dt id='7JJWG'><q id='7JJWG'><span id='7JJWG'><b id='7JJWG'><form id='7JJWG'><ins id='7JJWG'></ins><ul id='7JJWG'></ul><sub id='7JJWG'></sub></form><legend id='7JJWG'></legend><bdo id='7JJWG'><pre id='7JJWG'><center id='7JJWG'></center></pre></bdo></b><th id='7JJWG'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='7JJWG'><tfoot id='7JJWG'></tfoot><dl id='7JJWG'><fieldset id='7JJWG'></fieldset></dl></div>
                            <legend id='7JJWG'><style id='7JJWG'><dir id='7JJWG'><q id='7JJWG'></q></dir></style></legend>
                              <tbody id='7JJWG'></tbody>
                          • 主站蜘蛛池模板: 免费观看一级毛片 | 欧美一区二区三区 | 久久中文高清 | 蜜桃视频一区二区三区 | 亚洲精久久久 | 一级欧美一级日韩片免费观看 | 国产日韩欧美电影 | 99精品免费| 国产剧情一区 | 风间由美一区二区三区在线观看 | 精品麻豆剧传媒av国产九九九 | 农村真人裸体丰满少妇毛片 | 日韩在线中文字幕 | 欧美激情国产日韩精品一区18 | 我要看免费一级毛片 | 中文字幕综合 | 992tv人人草| 中文字幕一区二区三区四区五区 | 五月天婷婷久久 | 永久精品 | 中文字幕成人网 | 精精国产xxxx视频在线播放 | 亚洲精品成人 | 国产精品久久久久不卡 | 久久成人免费 | 国产精品久久久久久网站 | 欧产日产国产精品99 | v片网站| 天堂久久久久久久 | 国产日产精品一区二区三区四区 | a看片 | 欧美久久久久久久久 | 久草成人 | 久久1区 | 人人插人人 | 亚洲第一在线视频 | 国产一级电影在线 | 亚洲一二三在线观看 | 亚洲啊v在线 | 国产精品免费一区二区三区四区 | 91欧美精品成人综合在线观看 |