Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

支持 Node.js 和浏览器的打包工具 #105

Open
egoist opened this issue Jan 13, 2018 · 0 comments
Open

支持 Node.js 和浏览器的打包工具 #105

egoist opened this issue Jan 13, 2018 · 0 comments

Comments

@egoist
Copy link
Member

egoist commented Jan 13, 2018

基于 Parcel 的思路,实现一个可以在 Node.js 和浏览器中运行的 Bundler:

const bundler = new Bundler({
  path: '/absolute/path/to/main.js',
  content: `import foo from './foo'\nimport style from './style.css'`
})

{
	isRoot: true,
	content: `import foo from './foo.'\nimport style from './style.css'`,
	path: '/absolute/path/to/main.js'
	assets: [
		{
			content: `export default 'foo'`,
			path: '/absolute/path/to/foo.js',
			importPath: './foo.js',
			importNames: ['default'],
			isAsync: false
		},
		{
			content: 'body {color: red}',
			path: '/absolute/path/to/style.css',
			importPath: './style.css',
			importNames: ['default'],
			isAsync: false
		}
	]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant