plotly / plotly/plotly.js

Upgrading to plotly ^3- Angular build fails with this Webpack error: java Copy Edit Module parse failed: Unexpected token (1:0) You may need an appropriate loader to handle this file type

オープン
#7,466 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

bug P2
主要言語
JavaScript
スター
18.3k
フォーク
2k
平均マージ
2日 12時間
マージ済み PR(30日)
28

説明

When using a recent version of plotly.js (or @plotly/mapbox), which internally depends on maplibre-gl, the build fails with this Webpack error:
./node_modules/maplibre-gl/dist/maplibre-gl.css:1:0 - Error: Module parse failed: Unexpected token (1:0)

I have a custom webpack.config.js
const webpack = require('webpack');

module.exports = (config) => {
// Add polyfills
config.resolve = config.resolve || {};
config.resolve.fallback = {
...config.resolve.fallback,
stream: require.resolve('stream-browserify'),
buffer: require.resolve('buffer/')
};

config.plugins = config.plugins || [];
config.plugins.push(
new webpack.ProvidePlugin({
Buffer: ['buffer', 'Buffer'],
process: 'process/browser'
})
);

// Tell webpack to ignore CSS imports from plotly.js
config.module.rules.push({
test: /.css$/,
use: 'null-loader',
include: /node_modules[/\]plotly.js/
});

return config;
};

I have it in the styles on angular.json-
"build": {
"builder": "@angular-builders/custom-webpack:browser",
"options": {
"customWebpackConfig": {
"path": "./webpack.config.js"
},
"outputPath": "dist/sizingTool-ui",
"index": "src/index.html",
"main": "src/main.ts",
"polyfills": "src/polyfills.ts",
"tsConfig": "tsconfig.app.json",
"assets": [
"src/favicon.ico",
"src/assets"
],
"styles": [
"node_modules/bootstrap/dist/css/bootstrap.min.css",
"node_modules/maplibre-gl/dist/maplibre-gl.css",
"src/styles.css",
"src/theme.scss",
"node_modules/primeng/resources/themes/saga-green/theme.css",
"node_modules/primeng/resources/primeng.min.css",
"node_modules/primeicons/primeicons.css",
"node_modules/open-iconic/font/css/open-iconic-bootstrap.min.css",
"node_modules/ngx-spinner/animations/ball-newton-cradle.css"
],
"scripts": [],

コントリビューションガイド

コントリビューションガイドを開く

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

調査の方向性

webpack.config.js と angular.json の Angular ビルド設定から始め、記載されている maplibre-gl のスタイルシートとカスタム Webpack 設定を使用してビルドを再現します。CSS ファイルがどのように処理されるかを追跡し、報告されている「Module parse failed」エラーなしでビルドが完了することを確認します。

索引モデルが issue の本文から書いたものです。

評価

技術スタック
angular, javascript, webpack
領域
build-system, frontend
issue の種類
バグ
難易度
3/5
見積もり時間
1〜2日
活発さ
停滞
明瞭さ
おおむね明確
初心者へのやさしさ
35/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。