Parcel: 馃悰 Multiple pages with Parcel

Created on 13 Dec 2017  路  7Comments  路  Source: parcel-bundler/parcel

馃悰 bug report

I was trying out if it was possible to use multiple pages with Parcel

Configuration - only these 5 files

<!-- First page -->
<!doctype html>
<html>
<head>
<meta charset="utf-8">
</head>
<body>
  <a href="./index2.html">goto page2</a>
  <script type="text/javascript" src="./index.js"></script>
</body>
</html>
// index.js
import util from './util'
util.hi()
<!-- Second Page -->
<!doctype html>
<html>
<head>
<meta charset="utf-8">
</head>
<body>
  <a href="./index.html">goto page1</a>
  <script type="text/javascript" src="./index2.js"></script>
</body>
</html>
// index2.js
import util from './util.js'
util.hi()
// util.js
export default {
  hi() {
    console.log('hi')
  }
}

Command

parcel index.html

馃槸 Current Behavior

First Question

The first page(index.html) can link to second page(index2.html), but in the second page, the tag <a> doesn't have the correct attr 'href'.

Second Question

In the first page(index.html), I catch this Exception

Uncaught Error: Cannot find module '14'
    at newRequire (test-parcel.js:32)
    at localRequire (test-parcel.js:38)
    at Object.require.7../util (test-parcel.js:71)
    at newRequire (test-parcel.js:46)
    at require.7../util (test-parcel.js:63)
    at test-parcel.js:68

馃 Expected Behavior

First

the page1 and page2's <a> should have correct attr

Second

this Exception shouldn't be thrown and 'hi' should be printed

馃拋 Possible Solution

First Question

I don't know about this..

Second Question

I guess that may be caused by those two files(index.js, index2.js) import the same file(util.js)

馃實 Your Environment

| Software | Version(s)
| ---------------- | ----------
| Parcel | Latest on master
| Node | v8.9.0
| npm/Yarn | yarn 1.2.1
| Operating System | macOS 10.13

Bug Confirmed Bug

Most helpful comment

I'm working on this.

All 7 comments

Tested on Mac OS X High Sierra 10.13.2 and can confirm this doesn't work

I'm working on this.

Is this a duplicate of #189?

This is not related to #189 @davidnagli

Whoops ok I guess I just didn鈥檛 understand the issue, they just looked kinda similar.

I'm currently facing the exact same issue as well.

This should be fixed by #380.

Was this page helpful?
0 / 5 - 0 ratings